/**
 @file sys_usw_wb_common.h

 @date 2016-04-20

 @version v1.0

 The file defines queue api
*/

#ifndef _SYS_USW_WB_COMMON_H_
#define _SYS_USW_WB_COMMON_H_
#ifdef __cplusplus
extern "C" {
#endif

/****************************************************************
 *
 * Header Files
 *
 ***************************************************************/
#include "sal.h"

#include "ctc_const.h"
#include "ctc_macro.h"
#include "ctc_debug.h"
#include "ctc_warmboot.h"
#include "sys_usw_chip.h"
#include "sys_usw_datapath.h"
#include "drv_api.h"
#include "sys_usw_flexe.h"


#define SYS_WB_VERSION_L3IF                 CTC_WB_VERSION(5,0)
#define SYS_WB_VERSION_IPUC                 CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_IP_TUNNEL            CTC_WB_VERSION(5,0)
#define SYS_WB_VERSION_IPMC                 CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_MPLS                 CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_STATS                CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_SCL                  CTC_WB_VERSION(6,0)
#define SYS_WB_VERSION_ACL                  CTC_WB_VERSION(7,0)
#define SYS_WB_VERSION_VLAN                 CTC_WB_VERSION(3,0)
#define SYS_WB_VERSION_ADV_VLAN             CTC_WB_VERSION(3,0)
#define SYS_WB_VERSION_OVERLAY              CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_CHIP                 CTC_WB_VERSION(3,0)
#define SYS_WB_VERSION_LINKAGG              CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_PTP                  CTC_WB_VERSION(5,0)
#define SYS_WB_VERSION_SYNCETHER            CTC_WB_VERSION(3,0)
#define SYS_WB_VERSION_QOS                  CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_SECURITY             CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_OAM                  CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_PORT                 CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_L2                   CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_STACKING             CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_NEXTHOP              CTC_WB_VERSION(5,0)
#define SYS_WB_VERSION_APS                  CTC_WB_VERSION(3,0)
#define SYS_WB_VERSION_MIRROR               CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_IPFIX                CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_WLAN                 CTC_WB_VERSION(3,0)
#define SYS_WB_VERSION_DOT1AE               CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_DATAPATH             CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_REGISTER             CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_INTER_PORT           CTC_WB_VERSION(3,0)
#define SYS_WB_VERSION_PACKET               CTC_WB_VERSION(3,1)
#define SYS_WB_VERSION_SRV6                 CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_DTEL                 CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_MONITOR              CTC_WB_VERSION(4,0)
#define SYS_WB_VERSION_SC_OAM               CTC_WB_VERSION(3,0)
#define SYS_WB_VERSION_NPM                  CTC_WB_VERSION(2,0)
#define SYS_WB_VERSION_FLEXE                CTC_WB_VERSION(5,1)
#define SYS_WB_VERSION_PON                  CTC_WB_VERSION(1,0)
#define SYS_WB_VERSION_XDATA                CTC_WB_VERSION(1,0)


#define SYS_WB_APPID_SUBID_MAX       32

#define SYS_WB_FEATURE_MASTER_NUM              1    /*fixed value*/

#define SYS_WB_STACKING_SUBID_MCAST_DB_NUM     1280 /*user can change the value of the macro according to facts*/

#define SYS_WB_IPUC_SUBID_OFB_NUM              326 /*fixed value*/
#define SYS_WB_IPUC_SUBID_INFO_NUM             102400 /*user can change the value of the macro according to facts*/

#define SYS_WB_NPM_SUBID_IM_FLOW_HASH_NUM     1024 /*fixed value*/

#define SYS_WB_SCL_SUBID_DEFAULT_ENTRY_NUM     768 /*user experience value*/
#define SYS_WB_SCL_SUBID_FLEX_KEY_NUM     36 /*user experience value*/

#define SYS_WB_DOT1AE_SUBID_CHAN_BIND_NODE_NUM 16384 /*user experience value*/
#define SYS_WB_OAM_SUBID_OAMID_NUM             2048 /*user experience value*/
#define SYS_WB_FTM_SUBID_FCOE_TRILL_NUM        2048
#define SYS_WB_PACKET_SUBID_NETIF_NUM          64 /*user experience value*/
#define SYS_WB_WLAN_SUBID_TUNNEL_SW_ENTRY_NUM  2048 /*user experience value*/
#define SYS_WB_NH_SUBID_VNI_NUM                16384 /*user experience value*/
#define SYS_WB_PON_GEM_PORT_NUM                32768 /*user experience value*/
#define SYS_WB_PON_VLAN_PORT_NUM               32768 /*user experience value*/

/****************************************************************
*
*xdata module
*
****************************************************************/

enum sys_wb_appid_xdata_subid_e
{
    SYS_WB_APPID_XDATA_SUBID_MASTER,
    SYS_WB_APPID_XDATA_SUBID_PROF,
    SYS_WB_APPID_XDATA_SUBID_PATH,
    SYS_WB_APPID_XDATA_SUBID_FLEX_KEY,
    SYS_WB_APPID_XDATA_SUBID_MAX
};
typedef enum sys_wb_appid_xdata_subid_e sys_wb_appid_xdata_subid_t;

#define SYS_WB_XDATA_PROF_F_NUM 16
#define SYS_WB_XDATA_LOCAL_T_NUM 6
#define SYS_WB_XDATA_LOCAL_F_NUM 14
#define SYS_WB_XDATA_PATH_F_NUM 16
#define SYS_WB_XDATA_FK_F_NUM   32

struct sys_wb_xdata_local_field_s
{
    uint32 width       : 5;
    uint32 src_offset  : 8;
    uint32 dst_offset  : 8;
    uint32 rvs         :11;
};
typedef struct sys_wb_xdata_local_field_s sys_wb_xdata_local_field_t;

struct sys_wb_xdata_local_s
{
    uint32 type       :4;
    uint32 mode       :2; /* 0,only xdata; 1,only ctc_field, 2, mix local xdata */
    uint32 num        :4;
    uint32 ref_cnt    :6;
    uint32 rsv        :16;
    sys_wb_xdata_local_field_t  field[SYS_WB_XDATA_LOCAL_F_NUM];
};
typedef struct sys_wb_xdata_local_s sys_wb_xdata_local_t;

struct sys_wb_xdata_master_s
{
    /*key*/
    uint8 lchip;
    uint8 rsv[3];
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    sys_wb_xdata_local_t local[SYS_WB_XDATA_LOCAL_T_NUM];
};
typedef struct sys_wb_xdata_master_s sys_wb_xdata_master_t;

struct sys_wb_xdata_map_s
{
    uint32 width       : 5;
    uint32 src_offset  : 8;
    uint32 dst_offset  : 8;
    uint32 flag        : 8;
    uint32 rsv         : 3;
};
typedef struct sys_wb_xdata_map_s sys_wb_xdata_map_t;

struct sys_wb_xdata_profile_s
{
    /*key*/
    uint32 idx;        /* type <<4 + prof_id */
    uint32 calc_key_len[0];

    /*data*/
    uint32 num     :5;
    uint32 rsv1    :27;
    sys_wb_xdata_map_t map[SYS_WB_XDATA_LOCAL_F_NUM];
};
typedef struct sys_wb_xdata_profile_s sys_wb_xdata_profile_t;

struct sys_wb_xdata_path_s
{
    /*key*/
    uint32 idx;        /* type <<4 + prof_id */
    uint32 calc_key_len[0];

    /*data*/
    uint32 fixed_bmp         :16;
    uint32 num               :5;
    uint32 rsv1              :11;
    uint32 valid_bmp;
    sys_wb_xdata_map_t map[SYS_WB_XDATA_PATH_F_NUM];
};
typedef struct sys_wb_xdata_path_s sys_wb_xdata_path_t;

struct sys_wb_xdata_flex_key_f_s
{
    uint32 field          :8;  /*  refer to sys_xdata_fk_f_type_t*/
    uint32 bit_width      :5;  /* field reld bit width in container */
    uint32 pos_sel        :6;  /* in 4 bits */
    uint32 is_done        :1;  /* last field */
    uint32 father_field   :8;
    uint32 start_bit      :4;

    uint32 mask           :16;/* xdata mask in container*/
    uint32 width          :6;
    uint32 drv_offset     :10; /* write table field start bit offset */
};
typedef struct sys_wb_xdata_flex_key_f_s sys_wb_xdata_flex_key_f_t;

struct sys_wb_xdata_flex_key_s
{
    /*key*/
    uint32 tbl_id;
    uint32 type         :8;
    uint32 hash_type    :8;
    uint32 rsv          :16;
    uint32 calc_key_len[0];

    /*data*/
    uint32 mode            :2;
    uint32 fk_prof_id      :4;
    uint32 fk_mask_id      :4;
    uint32 key_size        :2;
    uint32 is_install      :1;
    uint32 udf_en          :1;
    uint32 key_sel         :4;
    uint32 rsv1            :14;

    sys_wb_xdata_flex_key_f_t fk_field[SYS_WB_XDATA_FK_F_NUM];

};
typedef struct sys_wb_xdata_flex_key_s sys_wb_xdata_flex_key_t;

/****************************************************************
*
*adv vlan module
*
****************************************************************/

enum sys_wb_appid_adv_vlan_subid_e
{
    SYS_WB_APPID_SUBID_ADV_VLAN_MASTER,
    SYS_WB_APPID_SUBID_ADV_VLAN_DEFAULT_ENTRY_ID,
    SYS_WB_APPID_SUBID_ADV_VLAN_RANGE_GROUP,
    SYS_WB_APPID_SUBID_ADV_VLAN_MAX
};
typedef enum sys_wb_appid_adv_vlan_subid_e sys_wb_appid_adv_vlan_subid_t;


struct sys_wb_adv_vlan_default_entry_id_s
{
    /*key*/
    uint8 tcam_id;
    uint8 rsv[3];
    uint32 calc_key_len[0];

    /*data*/
    uint32 mac_eid;
    uint32 ipv4_eid;
    uint32 ipv6_eid;
};
typedef struct sys_wb_adv_vlan_default_entry_id_s sys_wb_adv_vlan_default_entry_id_t;

struct sys_wb_adv_vlan_range_group_s
{
    /*key*/
    uint8 group_id;
    uint8 block_id;
    uint8 rsv[2];
    uint32 calc_key_len[0];

    /*data*/
    uint16 group_flag;
    uint16 vrange_mem_use_count[8];
    uint8 rsv1[2];

};
typedef struct sys_wb_adv_vlan_range_group_s sys_wb_adv_vlan_range_group_t;


typedef struct
{
    uint16 port_en          :1;
    uint16 default_valid    :1;
    uint16 rsv              :14;
    uint16 flag;                    /*refer to ctc_vlan_miss_flag_t*/
    uint32 user_data;
}sys_wb_vlan_class_default_info_t;

struct sys_wb_adv_vlan_master_s
{
    /*key*/
    uint8 lchip;
    uint8 rsv[3];
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    sys_wb_vlan_class_default_info_t default_info[2][SYS_USW_MAX_PORT_NUM];
};
typedef struct sys_wb_adv_vlan_master_s sys_wb_adv_vlan_master_t;

/****************************************************************
*
* wlan module
*
****************************************************************/
enum sys_wb_appid_wlan_subid_e
{
    SYS_WB_APPID_WLAN_SUBID_MASTER,
    SYS_WB_APPID_WLAN_SUBID_TUNNEL_SW_ENTRY,
    SYS_WB_APPID_WLAN_SUBID_MAX
};
typedef enum sys_wb_appid_wlan_subid_e sys_wb_appid_wlan_subid_T;

struct sys_wb_wlan_tunnel_sw_entry_s
{
    /*key*/
    uint16 tunnel_id;
    uint8 rsv0[2];
    uint32  calc_key_len[0];

    /*data*/
    union
    {
        ip_addr_t ipv4;         /**< [D2] IPv4 source address */
        ipv6_addr_t ipv6;       /**< [D2] IPv6 source address */
    } ipsa;
    union
    {
        ip_addr_t ipv4;         /**< [D2] IPv4 dest address */
        ipv6_addr_t ipv6;       /**< [D2] IPv6 dest address */
    } ipda;
    uint16 l4_port;             /**< [D2] udp dest port */
    uint16 network_count;       /**< [D2] network tunnel count */
    uint16 bssid_count;         /**< [D2] bssid tunnel count */
    uint16 bssid_rid_count;     /**< [D2] bssid rid tunnel count */
    uint8 is_ipv6;              /**< [D2] ipv4 or ipv6 */
    uint8 rsv1[3];
};
typedef struct sys_wb_wlan_tunnel_sw_entry_s sys_wb_wlan_tunnel_sw_entry_t;

struct sys_wb_wlan_master_s
{
    /*key*/
    uint32 default_clinet_entry_id;
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    uint32 l2_trans_edit_offset;
    uint16 default_client_vlan_id;
    uint8  default_client_action;
    uint32 scl_hash0_tunnel_gid;
    uint32 scl_hash1_tunnel_gid;
    uint32 scl_tcam0_tunnel_gid;
    uint32 scl_tcam1_tunnel_gid;
    uint32 scl_hash0_client_local_gid;
    uint32 scl_hash0_client_remote_gid;
    uint32 scl_hash1_client_local_gid;
    uint32 scl_hash1_client_remote_gid;
    uint32 scl_tcam0_client_local_gid;
    uint32 scl_tcam0_client_remote_gid;
    uint32 scl_tcam1_client_local_gid;
    uint32 scl_tcam1_client_remote_gid;
    uint8 rsv1;
};
typedef struct sys_wb_wlan_master_s sys_wb_wlan_master_t;

/****************************************************************
*
* OAM module
*
****************************************************************/
#define SYS_OAM_MAX_MAID_LEN 48
enum sys_wb_appid_oam_subid_e
{
    SYS_WB_APPID_OAM_SUBID_MASTER,
    SYS_WB_APPID_OAM_SUBID_CHAN,
    SYS_WB_APPID_OAM_SUBID_MAID,   /*maid may exist alone, have no relationship with mep, sync in this table*/
    SYS_WB_APPID_OAM_SUBID_OAMID,
    SYS_WB_APPID_OAM_SUBID_LMEP,
    SYS_WB_APPID_OAM_SUBID_RMEP,
    SYS_WB_APPID_OAM_SUBID_MAX
};
typedef enum sys_wb_appid_oam_subid_e sys_wb_appid_oam_subid_t;

struct sys_wb_oam_master_s
{
    /*key*/
    uint8 lchip;
    uint8  rsv0[3];
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    uint32 mep_index_alloc_by_sdk : 1; /*need check before updating*/
    uint32 tp_section_oam_based_l3if : 1;  /*need check before updating*/
    uint32 maid_len_format : 8;
    uint32 rsv : 22;
    uint32 oam_reource_bfdv6addr;
    uint32 oam_reource_lm;
    uint32 oam_reource_mep;
    uint32 oam_reource_key;
    uint32 oam_reource_rmep_key;
    uint32 defect_to_rdi_bitmap0;
    uint32 defect_to_rdi_bitmap1;
};
typedef struct sys_wb_oam_master_s sys_wb_oam_master_t;

struct sys_wb_oam_chan_s
{
    /*key*/
    uint32 hash_key_index;
    uint32 rmep_hash_key_index;
    uint32 calc_key_len[0];

    /*data*/

    uint32 lmep_lm_index_alloced : 1;
    uint32 eth_lm_index_alloced :1;\
    uint32 tp_lm_index_alloced : 1;
    uint32 is_vpws:1;
    uint32 link_oam:1;
    uint32 mep_type:4;
    uint32 key_pp_bmp:8;
    uint32 rsv0:15;
    uint32 tp_oam_key_index[2];

    uint32 label;
    uint32 gport;
    uint32 mep_index;
    uint32 local_discr;
    uint32 lmep_flag;
    uint16 vlan_id;                /*Ethoam vlan id can not get from asic when fid based*/
    uint8  tp_oam_key_valid[2];
    uint8 master_gchip;
    uint8  spaceid;
    uint8  rsv[2];
};
typedef struct sys_wb_oam_chan_s sys_wb_oam_chan_t;


struct sys_wb_oam_lmep_s
{
    /*key*/
    uint32 lmep_index;
    uint32 calc_key_len[0];

    /*data*/
    uint32 nhid;
    uint32 lmep_flag;
    uint32 key_index;
    uint32 label;
    uint32 local_discr;
    uint32 gport;
    uint32 lmep_lm_index_alloced:1;
    uint32 mep_type:4;           /*for wb restore*/
    uint32 md_level:3;
    uint32 spaceid:8;
    uint32 with_maid : 1;
    uint32 maid_entry_num:4;
    uint32 ref_cnt:8;
    uint32 link_oam:1;
    uint32 without_rmep:1;
    uint32 v_lmep:1;
    
    uint32 key_pp_bmp:8;
    uint32 pp_id:8;
    uint32 lm_index_base:16;
    
    uint32  lm_cos:4;
    uint32  lm_cos_type : 3;
    uint32  rsv:25;
};
typedef struct sys_wb_oam_lmep_s sys_wb_oam_lmep_t;


struct sys_wb_oam_rmep_s
{
    /*key*/
    uint32 rmep_index;
    uint32 calc_key_len[0];

    /*data*/
    uint32 rmep_flag;
    uint32 rmep_discr;
    uint32  rmep_id;
    uint32 key_index;
    uint32 lmep_index;
    uint8  mep_type;           /*for wb restore*/
    uint8  md_level;
    uint8  pp_id;
    uint8  rsv;
};
typedef struct sys_wb_oam_rmep_s sys_wb_oam_rmep_t;


struct sys_wb_oam_maid_s
{
    /*key*/
    uint8    mep_type;
    uint8    maid_len;
    uint8    maid_entry_num;
    uint8    ref_cnt;
    uint8    maid[SYS_OAM_MAX_MAID_LEN];
    uint32   calc_key_len[0];

    /*data*/
    uint32   maid_index;
};
typedef struct sys_wb_oam_maid_s sys_wb_oam_maid_t;
struct sys_wb_oam_oamid_s
{
    /*key*/
    uint32 oam_id;
    uint32 gport;
    uint32 calc_key_len[0];

    /*data*/
    void*  p_sys_chan_eth;
    uint32 label[2];
    uint8  space_id[2];
    uint8  rsv[2];
};
typedef struct sys_wb_oam_oamid_s sys_wb_oam_oamid_t;

/****************************************************************
*
* vlan module
*
****************************************************************/
enum sys_wb_appid_vlan_subid_e
{
    SYS_WB_APPID_VLAN_SUBID_MASTER,
    SYS_WB_APPID_VLAN_SUBID_OVERLAY_MAPPING_KEY,
    SYS_WB_APPID_VLAN_SUBID_MAX
};
typedef enum sys_wb_appid_vlan_subid_e sys_wb_appid_vlan_subid_t;

struct sys_wb_vlan_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];
    /*data*/
    uint32 version;
    uint32 vlan_bitmap[128];
    uint32 vlan_def_bitmap[128];
};
typedef struct sys_wb_vlan_master_s sys_wb_vlan_master_t;

struct sys_wb_vlan_overlay_mapping_key_s
{
    /*key*/
    uint32 vn_id;
    uint32 calc_key_len[0];
    /*data*/
    uint16 fid;
};
typedef struct sys_wb_vlan_overlay_mapping_key_s sys_wb_vlan_overlay_mapping_key_t;

/****************************************************************
*
* l3if module
*
****************************************************************/
enum sys_wb_appid_l3if_subid_e
{
    SYS_WB_APPID_L3IF_SUBID_MASTER,
    SYS_WB_APPID_L3IF_SUBID_PROP,
    SYS_WB_APPID_L3IF_SUBID_ECMP_IF,
    SYS_WB_APPID_L3IF_SUBID_ROUTER_MAC_ENTRY,
    SYS_WB_APPID_L3IF_SUBID_OFB,
    SYS_WB_APPID_L3IF_SUBID_ECMP_IF_MEMBER,
    SYS_WB_APPID_L3IF_SUBID_MAX
};
typedef enum sys_wb_appid_l3if_subid_e sys_wb_appid_l3if_subid_t;

struct sys_wb_l3if_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];

    /**data */
    uint32 version;
    uint8  keep_ivlan_en;
};
typedef struct sys_wb_l3if_master_s sys_wb_l3if_master_t;

struct sys_wb_l3if_prop_s
{
    /*key*/
    uint32 l3if_id;
    uint32 calc_key_len[0];

    /**data */
    uint32  vlan_id:16;
    uint32  cvlan_id:16;
    uint32  gport:16;
    uint32  vlan_ptr:16; /**< Vlanptr */
    uint32  l3if_type:2; /**< the type of l3interface , CTC_L3IF_TYPE_XXX */
    uint32  user_egs_rtmac:1;
    uint32  bind_en:1;
    uint32  rtmac_bmp:8;
    uint32  rsv:20;
};
typedef struct sys_wb_l3if_prop_s sys_wb_l3if_prop_t;

struct sys_wb_l3if_router_mac_entry_s
{
    /*key*/
    uint32 entry_id:16;
    uint32  rsv:16;
    uint32 calc_key_len[0];

    /**data */
    uint32 priority;
    uint32 fpa_offset_a;
};
typedef struct sys_wb_l3if_router_mac_entry_s sys_wb_l3if_router_mac_entry_t;

struct sys_wb_l3if_ecmp_if_s
{
    /*key*/
    uint32 ecmp_if_id:13;
    uint32   index:8;
    uint32   rsv0:11;
    uint32 calc_key_len[0];

    /**data */
    uint32 hw_group_id:16;
    uint32  intf_count:8;
    uint32  failover_en:1;
    uint32 ecmp_group_type:3;     /* refer to ctc_nh_ecmp_type_t */
    uint32 rsv1:4;
    uint32 ecmp_member_base:16;
    uint32 rsv2:16;
};
typedef struct sys_wb_l3if_ecmp_if_s sys_wb_l3if_ecmp_if_t;

struct sys_wb_l3if_ecmp_if_member_s
{
    /*key*/
    uint32 ecmp_if_id:13;
    uint32 rsv:18;
    uint32 calc_key_len[0];

    /**data */
    uint16 l3if_id;
};
typedef struct sys_wb_l3if_ecmp_if_member_s sys_wb_l3if_ecmp_if_member_t;

/****************************************************************
*
* dot1ae module
*
****************************************************************/
#define CTC_WB_DOT1AE_KEY_LEN             32
#define CTC_WB_DOT1AE_SALT_LEN            12

enum sys_wb_appid_dot1ae_subid_e
{
    SYS_WB_APPID_DOT1AE_SUBID_MASTER,
    SYS_WB_APPID_DOT1AE_SUBID_CHANNEL,
    SYS_WB_APPID_DOT1AE_SUBID_CHAN_BIND_NODE,
    SYS_WB_APPID_DOT1AE_SUBID_ENTRY,
    SYS_WB_APPID_DOT1AE_SUBID_MAX
};
typedef enum sys_wb_appid_dot1ae_subid_e sys_wb_appid_dot1ae_subid_T;


struct sys_wb_dot1ae_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];

    /**data */
    uint32 version;
    uint32 dp0_rx_bmp[4];
    uint32 dp0_tx_bmp[4];
    uint32 dp1_rx_bmp[4];
    uint32 dp1_tx_bmp[4];
    uint8 is_xpn; /*TMM..*/

};
typedef struct sys_wb_dot1ae_master_s sys_wb_dot1ae_master_t;

struct sys_wb_dot1ae_channel_s
{
    /*key*/
    uint32 chan_id;
    uint32 calc_key_len[0];

    /*data*/
    uint32  dir:1,
            an_en:4,/*an inuse*/
            an_valid:4,/*valid an cfg*/
            binding_type:2, /* refer to sys_dot1ae_bind_type_t */
            p2mp:1,
            scl_id:2,/*p2mp scl_id */
            enable:1, /*p2mp enable*/
            dp_bmp:2,
            is_xpn:1,
            pn_mode:2,
            clear_tag_en:1,
            binded:1,
            pp_id:4,
            is_use_plain:1,/* AT, sec_chan is use for packet bypass decryption */
            include_sci:1,
            macsecType:1,
            rsv2:3;
    uint32 gport;
    uint16 ref_cnt[2];
    uint8  sc_index[2];
    uint8 an[2];
};
typedef struct sys_wb_dot1ae_channel_s sys_wb_dot1ae_channel_t;


struct sys_wb_dot1ae_channel_bind_node_s
{
    /*key*/
    uint8 sc_index;
    uint8 dir;
    uint32 chan_id;
    uint8 rsv1[3];
    uint32 calc_key_len[0];


    /*data*/
    uint32        value;
};
typedef struct sys_wb_dot1ae_channel_bind_node_s sys_wb_dot1ae_channel_bind_node_t;



struct sys_wb_dot1ae_entry_s
{
    /*key*/
    uint32 entry_id;
    uint32 calc_key_len[0];


    /*data*/
    uint32 dir:1;                    /* ingress is decrypt, egress is encrypt, refer to ctc_direction_t; */
    uint32 dp_bmp:2;
    uint32 is_cam:2;
    uint32 key_type:3;
    uint32 rsv:21;

    uint16 hash_key_index[2];        /* index to key table, 0-511 */
    uint32 gport;
    uint32 chan_id;
};
typedef struct sys_wb_dot1ae_entry_s sys_wb_dot1ae_entry_t;



/****************************************************************
*
* port module
*
****************************************************************/
#define SYS_PORT_TX_MAX_FRAME_SIZE_NUM  16
enum sys_wb_appid_port_subid_e
{
    SYS_WB_APPID_PORT_SUBID_MASTER,
    SYS_WB_APPID_PORT_SUBID_PROP,
    SYS_WB_APPID_PORT_SUBID_MAC_PROP,
    SYS_WB_APPID_INTERPORT_SUBID_MASTER,
    SYS_WB_APPID_INTERPORT_SUBID_USED,
    SYS_WB_APPID_PORT_SUBID_MAX
};
typedef enum sys_wb_appid_port_subid_e sys_wb_appid_port_subid_t;

struct sys_wb_port_master_s
{
    /*key*/
    uint8 lchip;
    uint8 rsv[3];
    uint32 calc_key_len[0];

    /*data*/
    uint32  version;
    uint32  igs_isloation_bitmap;
    uint32  igs_isloation_bitmap1;
    uint16  internal_port_start;
    uint8   tx_frame_ref_cnt[SYS_PORT_TX_MAX_FRAME_SIZE_NUM];
};
typedef struct sys_wb_port_master_s sys_wb_port_master_t;

struct sys_wb_port_prop_s
{
    /*key*/
    uint16 lport;
    uint16 rsv;
    uint32 calc_key_len[0];

    /*data*/
    uint32 subif_en           :1;
    uint32 xfabric_type       :3;
    uint32 xpipe_type         :3; /* used for get xpipe type */
    uint32 is_mac_da          :1;
    uint32 lbk_en             :1;
    uint32 rsv0               :7;
    uint32 inter_lport        :16;
    uint32 nhid;

    uint16  network_port;
    uint16  rsv1;
};
typedef struct sys_wb_port_prop_s sys_wb_port_prop_t;

struct sys_wb_port_mac_prop_s
{
    /*key*/
    uint16 lport;
    uint8 rsv[2];
    uint32 calc_key_len[0];

    /*data*/
    uint32 port_mac_en        :1;
    uint32 speed_mode         :3;
    uint32 cl73_enable        :1;   /* 0-dis, 1-en*/
    uint32 old_cl73_status    :2;
    uint32 link_intr_en       :1;
    uint32 link_status        :1;
    uint32 unidir_en          :1;
    uint32 rx_rst_hold        :1;
    uint32 is_ctle_running    :1;
    uint32 port_fec_val       :3;
    uint32 rsv1               :17;
};
typedef struct sys_wb_port_mac_prop_s sys_wb_port_mac_prop_t;

struct sys_wb_interport_master_s
{
    /*key*/
    uint8 lchip;
    uint8 rsv[3];
    uint32 calc_key_len[0];
    /*data*/
    uint32  version;
};
typedef struct sys_wb_interport_master_s sys_wb_interport_master_t;

struct sys_wb_interport_used_s
{
    /*key*/
    uint16 idx1;
    uint16 idx2;
    uint32 calc_key_len[0];
    /*data*/
    uint32 used;
};
typedef struct sys_wb_interport_used_s sys_wb_interport_used_t;

/****************************************************************
*
* dmps module
*
****************************************************************/

enum sys_wb_appid_dmps_subid_e
{
    SYS_WB_APPID_DMPS_DMPS_SUBID_MASTER,
    SYS_WB_APPID_DMPS_DMPS_SUBID_PORT,
    SYS_WB_APPID_DMPS_DMPS_SUBID_MAC,
    SYS_WB_APPID_DMPS_DMPS_SUBID_CHAN,
    SYS_WB_APPID_DMPS_DMPS_SUBID_CHAN_RX,
    SYS_WB_APPID_DMPS_DMPS_SUBID_PCS,
    SYS_WB_APPID_DMPS_DMPS_SUBID_LSD,
    SYS_WB_APPID_DMPS_DMPS_SUBID_PSD,
    SYS_WB_APPID_DMPS_DMPS_SUBID_MAP,
    SYS_WB_APPID_DMPS_SUBID_MAX
};
typedef enum sys_wb_appid_dmps_subid_e sys_wb_appid_dmps_subid_t;


struct sys_wb_dmps_master_s
{
    /*key*/
    uint8 lchip;
    uint8 rsv[3];
    uint32 calc_key_len[0];

    /*data*/
    uint16 ext_lport_map[DMPS_MAX_PORT_NUM];
    sys_dmps_db_cpumac_map_t cpumac_map[DMPS_MAX_NUM_CPUMAC_MAP];
    uint32 mac_group_is_valid[DMPS_MAX_CORE_NUM];
    uint16 cpumac_dport[DMPS_MAX_NUM_CPUMAC_MAP];
    uint8  xpipe_alloc;
    uint8  rsv1[3];
    sys_dmps_db_chan2lsd_map_t chan_2_logic_serdes[DMPS_MAX_CORE_NUM][DMPS_NW_CPU_NUM_PER_CORE];
};
typedef struct sys_wb_dmps_master_s sys_wb_dmps_master_t;

struct sys_wb_dmps_port_s
{
    /*key*/
    uint16 port_id;
    uint16 rsv;
    uint32 calc_key_len[0];

    /*data*/
    uint32 port_type :6;    /* refer to sys_dmps_lport_type_t */
    uint32 if_type   :6;      /* refer to ctc_port_if_type_t */
    uint32 if_mode   :6;     /*refer to ctc_chip_serdes_mode_t*/
    uint32 fec_type  :5;    /*ctc_port_fec_type_t*/
    uint32 an_fec    :5;      /* refer to ctc_port_fec_type_t */
    uint32 is_rsv    :1;      /* is reserve for network and cpumac port */
    uint32 an_mode   :3;     /* refer to ctc_port_auto_neg_mode_t */

    uint8  mdio_map;
    uint8  phy_map;
    uint8  devno_map;

    sys_dmps_an_ability_t an_ability;   /* AN ability */
    
    uint32 port_idx           :3;     /* [Arctic] Cpumac port idx */
    uint32 an_en              :1;       /* AN  enable/disable */
    uint32 old_cl73_status    :2;
    uint32 link_intr_en       :1;
    uint32 link_status        :1;
    uint32 unidir_en          :1;
    uint32 rx_rst_hold        :1;
    uint32 is_ctle_running    :1;
    uint32 xpipe_en           :3;
    uint32 is_an_first        :1;
    uint32 link_fsm           :4;
    uint32 link_mode          :2;
    uint32 rsv1               :11;
};
typedef struct sys_wb_dmps_port_s sys_wb_dmps_port_t;

struct sys_wb_dmps_chan_s
{
    /*key*/
    uint16 chan_id;
    uint16 rsv;
    uint32 calc_key_len[0];

    /*data*/
    uint8 core_id;
    uint8 pp_id;
    uint8 dp_id;
    uint8 txqm_id;

    uint16 sub_chan_id;
    uint16 mac_client_id;

    uint32 speed_value;

    uint32 speed_mode :5;   /* refer to sys_port_speed_t */
    uint32 is_rsv     :1;   /* is reserve for network and cpumac channel */
    uint32 prio       :1;   /* 1: the chan is priority chan */
    uint32 rsv1       :25;
};
typedef struct sys_wb_dmps_chan_s sys_wb_dmps_chan_t;

struct sys_wb_dmps_chan_rx_s
{
    /*key*/
    uint16 chan_id;
    uint16 rsv;
    uint32 calc_key_len[0];

    /*data*/
    uint8 core_id;
    uint8 pp_id;
    uint8 dp_id;
    uint8 txqm_id;

    uint16 sub_chan_id;
    uint16 mac_client_id;

    uint32 speed_value;

    uint32 speed_mode :5;   /* refer to sys_port_speed_t */
    uint32 is_rsv     :1;   /* is reserve for network and cpumac channel */
    uint32 prio       :1;   /* 1: the chan is priority chan */
    uint32 rsv1       :25;
};
typedef struct sys_wb_dmps_chan_rx_s sys_wb_dmps_chan_rx_t;


struct sys_wb_dmps_mac_s
{
    /*key*/
    uint16 mac_id;
    uint16 rsv;
    uint32 calc_key_len[0];

    /*data*/
    uint32 mac_speed    :8;
    uint32 mac_group_id :8;
    uint32 mac_idx      :8;
    uint32 en           :1;
	uint32 rsv1         :7;
};
typedef struct sys_wb_dmps_mac_s sys_wb_dmps_mac_t;

struct sys_wb_dmps_pcs_s
{
    /*key*/
    uint16 pcs_id;
    uint16 rsv;
    uint32 calc_key_len[0];

    /*data*/
    uint32 pcs_idx:8;
    uint32 rx_rst_en:1;
    uint32 rsv1:23;
};
typedef struct sys_wb_dmps_pcs_s sys_wb_dmps_pcs_t;

struct sys_wb_dmps_lsd_s
{
    /*key*/
    uint16 serdes_id;
    uint16 rsv;
    uint32 calc_key_len[0];

    /*data*/
    uint32 logical_lane_id :8;  /*logic serdes idx in group*/
    uint32 pcs_l_idx       :8;    /*lane idx in a pcs port*/
    uint32 hss_id          :8;
	uint32 rsv1            :8;
};
typedef struct sys_wb_dmps_lsd_s sys_wb_dmps_lsd_t;

struct sys_wb_dmps_psd_s
{
    /*key*/
    uint16 serdes_id;
    uint16 rsv;
    uint32 calc_key_len[0];

    /*data*/
	uint32 serdes_speed;    /*speed value*/
    uint32 support_speed;   /* bmp sys_datapath_serdes_speed_t */

    uint32 pll_sel         :2;  /* 0: disable,1:plla. 2:pllb    for TM it means cmu_id+1, 0: disable, 1: plla(CMU0), 2: pllb(CMU1), 3: pllc(CMU2) */
    uint32 rate_div        :3; /*0: full, 1:1/2, 2:1/4, 3:1/8*/
    uint32 bit_width       :5;    /* bit width*/
    uint32 rx_polarity     :1;  /*0:normal, 1:reverse*/

    uint32 tx_polarity     :1;  /*0:normal, 1:reverse*/
    uint32 ocs             :5;  /*serdes over clock: ctc_chip_serdes_ocs_mode_t*/
    uint32 physical_lane_id:8; /*real serdes idx in group*/
    uint32 is_dyn          :1;
    uint32 rsv1            :6;
};
typedef struct sys_wb_dmps_psd_s sys_wb_dmps_psd_t;

struct sys_wb_dmps_map_s
{
    /*key*/
    uint16 dport_id;
    uint16 chan_id;
    uint16 chan_rx_id;
    uint16 logic_serdes_id;
    uint16 physical_serdes_id;
    uint32 calc_key_len[0];

    /*data*/
    uint16 mac_id;
    uint16 pcs_id;
};
typedef struct sys_wb_dmps_map_s sys_wb_dmps_map_t;


/****************************************************************
*
* mpls module
*
****************************************************************/
enum sys_wb_appid_mpls_subid_e
{
    SYS_WB_APPID_MPLS_SUBID_MASTER,
    SYS_WB_APPID_MPLS_SUBID_ILM_HASH,
    SYS_WB_APPID_MPLS_SUBID_MAX
};
typedef enum sys_wb_appid_mpls_subid_e sys_wb_appid_mpls_subid_t;

struct sys_wb_mpls_master_s
{
    /*key*/
    uint8 lchip;
    uint8 rsv[3];
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    uint32 pop_ad_idx;
    uint32 decap_ad_idx;
    uint8  mpls_tcam0;
    uint8  mpls_tcam1;
    uint8  decap_mode;
    uint8  decap_tcam_group;
    uint16  mpls_tcam_max;
    uint16  mpls_cur_tcam;
    uint8  rsv0;
};
typedef struct sys_wb_mpls_master_s sys_wb_mpls_master_t;

struct sys_wb_mpls_ilm_hash_s
{
    /*key*/
    uint32 label;
    uint8 spaceid;
    uint32 calc_key_len[0];

    /*action*/
    uint32 model:7;
    uint32 type:4;
    uint32 id_type:4;
    uint32 is_tcam:1;
    uint32 is_vpws_oam:1;
    uint32 is_tp_oam:1;
    uint32 bind_dsfwd:1;
    uint32 u2_type:7;
    uint32 is_assignport:1;
    uint32 is_logicsrcport:1;
    uint32 is_esid:1;
    uint32 rsv1:2;
    uint8  u4_type;
    uint32 nh_id;
    uint16 service_id;
    uint8 actionrsv;
    uint16 oam_id;
    uint32 gport;
    uint8 u1_type;         /* TMM: u1 union check */
	uint8 ufwd_type;       /* TMM: ufwd union check */
    uint8 ufwd2_type;      /* TMM: ufwd2 union check */
    uint16 policer_id;
};
typedef struct sys_wb_mpls_ilm_hash_s sys_wb_mpls_ilm_hash_t;

/****************************************************************
*
* fdb module
*
****************************************************************/
enum sys_wb_appid_l2_subid_e
 {
    SYS_WB_APPID_L2_SUBID_MASTER,
    SYS_WB_APPID_L2_SUBID_FDB,
    SYS_WB_APPID_L2_SUBID_VPORT_2_NHID,
    SYS_WB_APPID_L2_SUBID_FID_NODE,
    SYS_WB_APPID_L2_SUBID_MCAST,
    SYS_WB_APPID_L2_SUBID_MAX
 };
 typedef enum sys_wb_appid_l2_subid_e sys_wb_appid_l2_subid_t;

struct sys_wb_l2_master_s
{
    /*key*/
    uint8       lchip;
    uint8       rsv[3];
    uint32      calc_key_len[0];
    /*data*/
    uint32      version;
    uint32      ad_index_drop;
    uint32      cfg_vport_num;
    uint32      l2mc_count;
    uint32      cfg_max_fid : 16;
    uint32      search_depth:8;
    uint32      cfg_hw_learn:1;
    uint32      static_fdb_limit:1;
    uint32      vp_alloc_ad_en:1;
    uint32      rsv1:5;
};
typedef struct sys_wb_l2_master_s   sys_wb_l2_master_t;

struct sys_wb_l2_fdb_s
{
    mac_addr_t     mac;
    uint16         fid;

    uint32         calc_key_len[0];
    uint32         nh_id;
    uint32         ad_index : 24;
    uint32         bind_nh:1;
    uint32         rsv_ad:1;
    uint32         reverse:1;
    uint32         rsv1:5;
    uint32         flag : 16;         /**<ctc_l2_flag_t */
    uint32         rsv2 : 16;
};
typedef struct sys_wb_l2_fdb_s  sys_wb_l2_fdb_t;

struct sys_wb_l2_vport_2_nhid_s
{
    /*key*/
    uint16  vport;
    uint8   rsv[2];
    uint32  calc_key_len[0];
    /*data*/
    uint32  nhid;
    uint32 ad_idx : 24;
    uint32 use_ldp : 1;
    uint32 rsv1 : 7;
    uint32 ad_idx1;
};
typedef struct sys_wb_l2_vport_2_nhid_s sys_wb_l2_vport_2_nhid_t;

struct sys_wb_l2_fid_node_s
{
    /*key*/
    uint16         fid;
    uint8          rsv[2];
    uint32         calc_key_len[0];
    /*data*/
    uint32         flag : 16;         /**<ctc_l2_dft_vlan_flag_t */
    uint32         cid : 16;
    uint32         mc_gid : 20;
    uint32         share_grp_en : 1;
    uint32         xdata_en : 1;
    uint32         rsv1 : 10;
};
typedef struct sys_wb_l2_fid_node_s sys_wb_l2_fid_node_t;

/****************************************************************
*
* stacking module
*
****************************************************************/
#define SYS_WB_STK_MAX_TRUNK_ID  127
#define SYS_WB_STK_TRUNK_BMP_NUM   ((SYS_WB_STK_MAX_TRUNK_ID + CTC_UINT32_BITS) / CTC_UINT32_BITS)


enum sys_wb_appid_stacking_subid_e
{
    SYS_WB_APPID_STACKING_SUBID_MASTER,
    SYS_WB_APPID_STACKING_SUBID_TRUNK,
    SYS_WB_APPID_STACKING_SUBID_MCAST_DB,
    SYS_WB_APPID_STACKING_SUBID_MAX
};
typedef enum sys_wb_appid_stacking_subid_e sys_wb_appid_stacking_subid_t;

struct sys_wb_stacking_master_s
{
    /*key*/
    uint8 lchip;
    uint8 rsv[3];
    uint32 calc_key_len[0];

    /*data*/
    uint32  version;
    uint32  stacking_mcast_offset:16;
    uint32  binding_trunk :1;
    uint32  bind_mcast_en : 1;
    uint32  rsv1:14;
    ctc_port_bitmap_t ing_port_en_bmp;
    ctc_port_bitmap_t egr_port_en_bmp;
    uint16  rchip_ad_rsv[SYS_USW_MAX_GCHIP_CHIP_ID+1];
};
typedef struct sys_wb_stacking_master_s sys_wb_stacking_master_t;

struct sys_wb_stacking_mcast_db_s
{
    /*key*/
    uint8   type;
    uint8   rsv;
    uint16  id;
    uint32 calc_key_len[0];

    /*data*/
    uint32   head_met_offset;
    uint32   tail_met_offset;

    uint32 append_en : 1;
    uint32 alloc_id : 1;
    uint16 mcast_prf_id : 16;
    uint32 rsv1  : 14;
    uint32 last_tail_offset;

    uint32   trunk_bitmap[SYS_WB_STK_TRUNK_BMP_NUM];
};
typedef struct sys_wb_stacking_mcast_db_s sys_wb_stacking_mcast_db_t;

struct sys_wb_stacking_trunk_s
{
    /*key*/
    uint16 trunk_id;
    uint16 rsv;
    uint32 calc_key_len[0];

    /*data*/
    uint16 max_mem_cnt;
    uint16 flow_cnt;
    uint32 replace_en :1;
    uint32 mode : 4;
    uint32 rsv1 : 27;
};
typedef struct sys_wb_stacking_trunk_s sys_wb_stacking_trunk_t;
/****************************************************************
*
* ACL module
*
****************************************************************/
#define SYS_WB_FPA_KEY_SIZE_NUM 4
#define SYS_WB_ACL_IGS_BLK_MAX_NUM 24
#define SYS_WB_ACL_XDATA_SEL_MAX_NUM 10
#define SYS_WB_ACL_ALLOC_COUNT_NUM 5
#define SYS_WB_ACL_HASH_KEY_TYPE_NUM 6
#define SYS_WB_ACL_HASH_SEL_PROFILE_MAX 16
#define SYS_WB_ACL_MAX_UDF_ENTRY_NUM 512
#define SYS_WB_ACL_RANGE_TYPE_NUM 7
#define SYS_WB_ACL_FIELD_COUNT (CTC_FIELD_KEY_NUM+128)
#define SYS_WB_SCL_FIELD_COUNT (CTC_FIELD_KEY_NUM+10)
struct sys_wb_acl_udf_buffer_s
{
    uint32 key[32];
    uint32 mask[32];
};
typedef struct sys_wb_acl_udf_buffer_s sys_wb_acl_udf_buffer_t;

enum sys_wb_appid_acl_subid_s
{
    SYS_WB_APPID_ACL_SUBID_MASTER,
    SYS_WB_APPID_ACL_SUBID_GROUP,
    SYS_WB_APPID_ACL_SUBID_TCAM_ENTRY,
    SYS_WB_APPID_ACL_SUBID_HASH_ENTRY,
    SYS_WB_APPID_ACL_SUBID_TCAM_CID,
    SYS_WB_APPID_ACL_SUBID_BLOCK,
    SYS_WB_APPID_ACL_SUBID_UDF_ENTRY,
    SYS_WB_APPID_ACL_SUBID_LT_BLOCK,
    SYS_WB_APPID_ACL_SUBID_PRESEL,
    SYS_WB_APPID_ACL_SUBID_FLEX_KEY,
    SYS_WB_APPID_ACL_SUBID_ASET,
    SYS_WB_APPID_ACL_SUBID_MAX
};
typedef enum sys_wb_appid_acl_subid_s sys_wb_appid_acl_subid_t;

struct sys_wb_acl_block_s
{
    uint16      block_id;
    uint8       rsv[2];
    uint32      calc_key_len[0];

    uint16      entry_count;  /* entry count on each block in software*/
    uint16      entry_num;    /* entry number for one block in physical*/
    uint16      start_offset[SYS_WB_FPA_KEY_SIZE_NUM];
    uint16      sub_entry_count[SYS_WB_FPA_KEY_SIZE_NUM];

    uint16              lkup_level_start[SYS_WB_ACL_IGS_BLK_MAX_NUM]; /*each merged lookup level start offset*/
    uint16              lkup_level_count[SYS_WB_ACL_IGS_BLK_MAX_NUM]; /*each merged lookup level start offset*/
    uint32      lkup_level_bitmap;
    uint32      merged_to           : 8;        /*which priority this lookup level merged to*/
    uint32      block_status        : 2;
    uint32      valid               : 1;
    uint32      same_size           : 1;
    uint32      part                : 4;
    uint32      rsv2                : 16;
    uint32      fpa_block_base;
    uint16      vblock_entry_count;
    uint16      vblock_sub_entry_count;

    uint8       expand_blk_id;
    uint8       hdr_block;
    uint8       size;
    uint8       part_num;
    uint8       prev_block;
    uint8       next_block;
    uint16      lkup_level_bitmap_high;
    uint16      rsv1;
};
typedef struct sys_wb_acl_block_s sys_wb_acl_block_t;

struct sys_wb_acl_lt_block_s
{
    uint16      block_id;
    uint8       rsv[2];
    uint32      calc_key_len[0];

    uint32      entry_valid;
    uint32      is_key160;
    uint32      ltid_bitmap;

    uint16      start_offset;
    uint16      entry_count;
    uint8       valid;
};
typedef struct sys_wb_acl_lt_block_s sys_wb_acl_lt_block_t;

struct sys_wb_acl_udf_entry_s
{
    /*key*/
    uint32   udf_id;
    uint32  calc_key_len[0];

    /*data*/
    uint32    key_index     :10 ;  /* DT2,TM: 0~15; TMM: 0~511, is_sudf means ad_index*/
    uint32    is_sudf:1;
    uint32          key_index_used:1;
    uint32          ip_op         :1;
    uint32          ip_frag       :1;
    uint32          mpls_num      :1;
    uint32          l4_type       :4;
    uint32         udf_offset_num:4;
    uint32          ip_protocol   :1;
    uint32          granularity   :1;
    uint32   offset_type_valid  :1;
    uint32   is_installed :1;
    uint32   rsv          : 5;
    
    uint32   udf_hit_index :10; /* used to acl key udf_hit_index*/
    uint32   scl_key_valid:1;
    uint32   scl_offset_num:5;
    uint32   prio:16;
    
};
typedef struct sys_wb_acl_udf_entry_s   sys_wb_acl_udf_entry_t;

struct sys_wb_hash_sel_field_union_s
{
    uint8   l4_port_field; 	     /*l4_port_field:  0:none; 1:gre/nvgre: 2:vxlan; 3:l4 port; 4:icmp; 5:igmp */
    uint8   l4_port_field_bmp;   /*for 1:gre/nvgre; bit0:CTC_FIELD_KEY_GRE_KEY;     bit1:CTC_FIELD_KEY_NVGRE_KEY;   (can't exist at the same time)*/
                                 /*for 2:vxlan;     CTC_FIELD_KEY_VN_ID     (only one field, no need l4_port_field_bmp)*/
                                 /*for 3:l4 port;   bit2:CTC_FIELD_KEY_L4_DST_PORT; bit3:CTC_FIELD_KEY_L4_SRC_PORT; (can exist at the same time)*/
                                 /*for 4:icmp;      bit4:CTC_FIELD_KEY_ICMP_CODE;   bit5:CTC_FIELD_KEY_ICMP_TYPE;   (can exist at the same time)*/
                                 /*for 5:igmp;      CTC_FIELD_KEY_IGMP_TYPE (only one field, no need l4_port_field_bmp)*/
    uint8   key_port_type;       /*0:none; 1:key port;   2:metadata*/
    uint8   l2_l3_key_ul3_type;  /*0:none; 1:ip; 2:mpls; 3:Unknown_etherType*/

        /*asic u1Type == 0 ipHeaderError/ipOptions/fragInfo/ttl/tcpFlags*/
        /*u1Type == 1 ipHeaderError/ipOptions/fragInfo/vrfId/isRouteMac*/
        /*u1Type == 2 ipPktLenRangeId/l4PortRangeBitmap/tcpFlags*/
        /*u1Type == 3 ipHeaderError/ipOptions/fragInfo/ttl/layer3HeaderProtocol */
    uint8   l3_key_u1_type;   /*sw :asic u1Type+1 , 0:none; 1:g1; 2:g2; 3:g3; 4:g4. sw not support cfg l3_key_u1_type;default to 1*/
    uint8   ipv6_key_ip_mode;   /*0:none;1;full ip;2:compress ip,sw not support cfg ipv6_key_ip_mode.default to 1*/
};
typedef struct sys_wb_hash_sel_field_union_s   sys_wb_hash_sel_field_union_t;

struct sys_wb_acl_master_s
{
    /*key*/
    uint8 lchip;
    uint8 rsv1[3];
    uint32 calc_key_len[0];

    /*data*/
    uint32  version;
    sys_wb_hash_sel_field_union_t              hash_sel_key_union_filed[SYS_WB_ACL_HASH_KEY_TYPE_NUM][SYS_WB_ACL_HASH_SEL_PROFILE_MAX];
    uint32 league_update_bmp    :3;
    uint32 egs_league_update_bmp:3;
    uint32 glb_presel_en        :1;
    uint32 srv6_rsv_udf_idx     :10;
    uint32 sort_mode            :8;
    uint32 rsv                  :7;
    uint32 global_pp_en_bmp[CTC_BOTH_DIRECTION];
};
typedef struct sys_wb_acl_master_s sys_wb_acl_master_t;

struct sys_wb_acl_field_range_s
{
    /*key*/
    uint8 range_id;
    uint8 rsv[3];
    uint32 calc_key_len[0];

    /*data*/
    uint16 min;
    uint16 max;
    uint16 ref_cnt;
    uint8  range_type;
    uint8  rsv1;
};
typedef struct sys_wb_acl_field_range_s sys_wb_acl_field_range_t;

typedef struct sys_wb_acl_aset_s{
    uint8 aset_id;

    uint8   xdata_prof_id :3;
    uint8   rsv           :5;
    uint16  u1_type     : 3,
            u2_type     : 3,
            u3_type     : 3,
            u4_type     : 3,
            u5_type     : 1,
            type        : 2,
            is_static   : 1;

    uint32 calc_key_len[0];
    uint32 w[CTC_B2W_SIZE(CTC_ACL_FIELD_ACTION_NUM)];
}sys_wb_acl_aset_t;

struct sys_wb_acl_group_s
{
    /*key*/
    uint32  group_id;
    uint32  calc_key_len[0];

    /*data*/
    uint8       type;
    uint8       block_id;      /* block the group belong. For hash, 0xFF. */
    uint8       dir;           /* 0: ingress  1:egress*/
    uint8       bitmap_status;
    union
    {
        ctc_port_bitmap_t port_bitmap;
        uint16            port_class_id;
        uint16            vlan_class_id;
        uint16            l3if_class_id;
        uint16            service_id;
        uint8             pbr_class_id;
        uint16            gport;
    } un;
    uint32      flag        :16,
                aset_idx    :8,
                rsv         :8;
};
typedef struct sys_wb_acl_group_s sys_wb_acl_group_t;

struct sys_wb_acl_range_info_s
{
    uint8  flag;
    uint8  range_id[SYS_WB_ACL_RANGE_TYPE_NUM];

    uint16 range_bitmap;
    uint16 range_bitmap_mask;
    uint8  is_program_rg    :1;
    uint8  rsv              :7;
};
typedef struct sys_wb_acl_range_info_s sys_wb_acl_range_info_t;

struct sys_wb_acl_tcam_entry_s
{
    /*key*/
    uint32 entry_id;
    uint32 calc_key_len[0];

    /*data*/
    uint32  priority;  /* entry priority. . */
    uint32  group_id;

    uint32  key_type            : 8,
            aset_id             : 8,
            /*grp_idx            : 12,*/
            npm_union_bmp       : 6,
            u1_type             : 2,
            u2_type             : 3,
            u3_type             : 3,
            u4_type             : 2;

    uint32  key_flag             : 16;
    uint32  u5_type              : 3;
    uint32  im_d_flag            : 1;
    uint32  rsv1                 : 12;

    uint32  offset_a           : 18,     /* key index. max: 2 local_chips*/
            step               : 3,
            is_install         : 1,
            im_l_flag          : 1,
            action_flag        : 8;
 
    uint32  l2_type              : 2,
            l3_type              : 4,
            l4_type              : 4,
            l4_user_type         : 4,
            key_mergedata_mode   : 2,     /*0,1:Wlan Info;2:MergeData*/
            key_l4_port_mode     : 2,     /*0,1:l4port;2:vxlan;3:gre*/
            cpu_reason_id        : 10,
            ad_type              : 3;

    uint32  policer_mode         : 3,
            cos_index            : 3,
            wlan_bmp             : 3,    /*pe->wlan_bmp : 0,CTC_FIELD_KEY_WLAN_RADIO_MAC; 1,CTC_FIELD_KEY_WLAN_RADIO_ID; 2,CTC_FIELD_KEY_WLAN_CTL_PKT */
            key_port_mode        : 3,     /*ref sys_acl_key_port_mode_t*/
            igmp_snooping        : 1,
            macl3basic_key_cvlan_mode:2, /*0,none;1:ip_da;  2:Aware Tunnel Info:CTC_FIELD_KEY_AWARE_TUNNEL_INFO*/
            macl3basic_key_macda_mode:2, /*0,none;1:mac_da; 2:Aware Tunnel Info:CTC_FIELD_KEY_AWARE_TUNNEL_INFO*/
            fwd_key_nsh_mode     : 2,    /*0,1:nsh;2:udf*/
            mac_key_vlan_mode    : 2,    /*0,1:svlan;2:cvlan*/
            ip_dscp_mode         : 2,     /*0,1:dscp;2:ecn/PRECEDENCE*/
            copp_ext_key_ip_mode : 2,     /*0,1:ip;2:udf*/
            range_valid          : 1,
            ceth_valid           : 1,
            bind_nh              : 1,
            ldp_valid            : 1,
            sts_valid            : 1,
            aset_level           : 2;
            
    uint32  nexthop_id;      /* only igs */

};
typedef struct sys_wb_acl_tcam_entry_s sys_wb_acl_tcam_entry_t;

struct sys_wb_acl_hash_entry_s
{
    /*key*/
    uint32 entry_id;
    uint32 calc_key_len[0];

    /*data*/
    uint32  group_id;
    
    uint32  aset_id            : 12,
            cos_index          : 3,
            igmp_snooping      : 1,
            action_flag        : 8,
            policer_mode       : 3,
            u1_type            : 3,
            hash_sel_tcp_flags : 2;

    uint32  key_type           : 8,      /* CTC_ACL_KEY_HASH_MAC,IPV4, L2_L3, MPLS, IPV6, NSH */
            key_index          : 24;     /* key index.*/

    uint32  is_install         : 1,
            hash_valid         : 1,          /*generated hash index*/
            key_exist          : 1,    /*key exist*/
            key_conflict       : 1,    /*hash key conflict*/
            l4_type            : 4,
            mac_key_vlan_mode  : 2,    /*0,1:svlan;2:cvlan*/
            cid_mode           : 3,
            bind_nh            : 1,
            ldp_valid          : 1,
            sts_valid          : 1,
            hash_sel_id        : 4,
            cpu_reason_id      : 10;


    /*uint32 policer_id;*/                        /*used for show action field: per entry only have one of the three;
                                                CTC_ACL_FIELD_ACTION_COPP; CTC_ACL_FIELD_ACTION_MICRO_FLOW_POLICER; CTC_ACL_FIELD_ACTION_MACRO_FLOW_POLICER */
    uint32  nexthop_id;
    /*ctc_acl_aset_t aset;*/
};
typedef struct sys_wb_acl_hash_entry_s sys_wb_acl_hash_entry_t;


struct sys_wb_acl_presel_s
{
    /*key*/
    uint32 presel_id;
    uint32 calc_key_len[0];

    /*data*/
    uint32 flag;
    uint32 priority;
    uint32 fpa_offset_a;
    uint8  lkup_level;
    uint8  key_type;
    uint8  fpa_flag;
    uint8  fpa_step;
};
typedef struct sys_wb_acl_presel_s sys_wb_acl_presel_t;

typedef struct sys_wb_acl_kset_s {
    uint32 w[CTC_B2W_SIZE(SYS_WB_ACL_FIELD_COUNT)];
} sys_wb_acl_kset_t;

struct sys_wb_acl_flex_key_s
{
    uint8  key_type;
    uint8  dir;
    uint8  is_flex_key;
    uint8  node_type;
    uint32 calc_key_len[0];
    
    union {
        struct flex_t{
            uint32  key_size    : 2,
                    key_req_bits: 9,
                    rsv         : 5,
                    flags       : 16;
            uint32 ltid_valid   : 24,
                   lkup_type    : 8;
            uint8  ltid[SYS_WB_ACL_IGS_BLK_MAX_NUM];
            uint8  xdata_sel[SYS_WB_ACL_XDATA_SEL_MAX_NUM];
        }u_flex;
        struct fixed_t{
            uint8  origin_key_type;
            uint16 eth_type;
            uint32 l3_type      :4;
            uint32 l4_type      :4;
            uint32 l4_user_type :4;
            uint32 entry_count  :16;
            uint32 rsv          :4;
        }u_fixed;
        struct flow_t{
            uint32 hash_type          : 8,
                   origin_key_type    : 8,
                   key_size           : 3,
                   mode               : 2,
                   udf_bmp            : 8,
                   rsv                : 3;
            }u_flow;
    }val;

    sys_wb_acl_kset_t kset;
};
typedef struct sys_wb_acl_flex_key_s sys_wb_acl_flex_key_t;

/****************************************************************
*
* ipuc module
*
****************************************************************/
#define MAX_CTC_IP_VER 2
#define CTC_WB_MAX_STATS_TYPE 10
#define MAX_CALPM_TABLE 2

enum sys_wb_appid_ipuc_subid_e
{
    SYS_WB_APPID_IPUC_SUBID_MASTER,
    SYS_WB_APPID_IPUC_SUBID_ALPM_MASTER,
    SYS_WB_APPID_IPUC_SUBID_OFB,
    SYS_WB_APPID_IPUC_SUBID_INFO,
    SYS_WB_APPID_IPUC_SUBID_INFO1,
    SYS_WB_APPID_IPUC_SUBID_PIVOT,

    SYS_WB_APPID_IPUC_SUBID_MAX
};
typedef enum sys_wb_appid_ipuc_subid_e sys_wb_appid_ipuc_subid_t;

struct sys_wb_nalpm_info_s
{
    uint32 tcam_idx        : 16;
    uint32 sram_idx        : 16;
    uint32 snake_idx       : 8;
    uint32 entry_offset    : 8;
    uint32 sub_bkt         : 3;
    uint32 rsv             : 13;
};
typedef struct sys_wb_nalpm_info_s sys_wb_nalpm_info_t;

struct sys_wb_nalpm_prefix_info_s
{
    /*key*/
    uint32 lchip             : 8;
    uint32 tcam_idx          : 16;
    uint32 rsv               : 8;
    uint32 calc_key_len[0];

    /*data*/
    uint32 ad_route_addr[4];
    uint32 ad_route_masklen  : 8;
    uint32 ip_ver            : 8;
    uint32 rsv1              : 16;
};
typedef struct sys_wb_nalpm_prefix_info_s sys_wb_nalpm_prefix_info_t;


struct sys_wb_nalpm_pivot_info_s
{
    /*key*/
    uint32 lchip              : 8;
    uint32 sram_idx           : 14;
    uint32 snake_idx          : 4;

    uint32 entry_offset       : 3;
    uint32 sram_type          : 3;

    uint32 calc_key_len[0];

    /*data*/
    uint32 ad_route_addr[4];
    uint32 ad_route_masklen   : 8;
    uint32 ip_ver             : 8;
    uint32 rsv1               : 16;
};
typedef struct sys_wb_nalpm_pivot_info_s sys_wb_nalpm_pivot_info_t;

struct sys_wb_calpm_master_s
{
    /*key*/
    uint32 lchip;   /*lchip*/
    uint32 calc_key_len[0];

    /*data*/
    uint8 couple_mode;
    uint8 ipsa_enable;
    uint8 prefix_length;   /* defaut use lpm_prefix8 */
    uint8 rsv;
};
typedef struct sys_wb_calpm_master_s sys_wb_calpm_master_t;

struct sys_wb_calpm_info_s
{
    uint16 stage_base[MAX_CALPM_TABLE];
    uint8  idx_mask[MAX_CALPM_TABLE];
    uint32 key_index:16;
    uint32 masklen_pushed:8;             /* pushed masklen */
    uint32 is_mask_valid:1;              /* 0 means have push down, but no match key and do nothing */
    uint32 is_pushed:1;                  /* if new, need push */
    uint32 rsv:6;
};
typedef struct sys_wb_calpm_info_s sys_wb_calpm_info_t;



struct sys_wb_ipuc_master_s
{
    /*key*/
    uint32 lchip;   /*lchip*/
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;

    uint8 host_lpm_mode;    /* host route mode, if set 1 means host route can use as lpm */
    uint8 tcam_mode;
    uint32 default_nhid[MAX_CTC_IP_VER];
    uint8 prefix64_mode;
    uint32 lpm_tcam_spec[MAX_CTC_IP_VER];
    uint8 rsv;
};
typedef struct sys_wb_ipuc_master_s sys_wb_ipuc_master_t;

struct sys_wb_ipuc_info_s
{
    /*key*/
    uint32 ip[4];
    uint32 route_flag;
    uint32 vrf_id           : 16;
    uint32 l4_dst_port      : 16;
    uint32 masklen          : 8;
    uint32 route_opt        : 3;
    uint32 rsv              : 21;
    uint32 calc_key_len[0];

    /*data*/
    uint32 key_index;
    uint32 ad_index;
    uint32 nh_id;

    union
    {
        #if defined(DUET2)
        sys_wb_calpm_info_t calpm_info;
        #endif
        sys_wb_nalpm_info_t nalpm_info;
    } lpm_info;
};
typedef struct sys_wb_ipuc_info_s sys_wb_ipuc_info_t;

/****************************************************************
*
* ipuc tunnel module
*
****************************************************************/
enum sys_wb_appid_ip_tunnel_subid_e
{
    SYS_WB_APPID_IP_TUNNEL_SUBID_MASTER,
    SYS_WB_APPID_IP_TUNNEL_SUBID_NATSA_INFO,
    SYS_WB_APPID_IP_TUNNEL_SUBID_OFB,
    SYS_WB_APPID_IP_TUNNEL_SUBID_MAX
};
typedef enum sys_wb_appid_ip_tunnel_subid_e sys_wb_appid_ip_tunnel_subid_t;

struct sys_wb_ip_tunnel_master_s
{
    /*key*/
    uint32 lchip;   /*lchip*/
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    uint32 snat_hash_count; /*snat store in host1 SaPort hash*/
    uint32 snat_tcam_count; /*snat store in tcam*/
    uint32 napt_hash_count; /*napt store in host1 Daport hash*/
};
typedef struct sys_wb_ip_tunnel_master_s sys_wb_ip_tunnel_master_t;

struct sys_wb_ip_tunnel_natsa_info_s
{
    /*key*/
    union
    {
        ip_addr_t ipv4;
        ipv6_addr_t ipv6;
    }ipsa;
    uint32 l4_src_port  :16;
    uint32  vrf_id      :15;
    uint32  is_tcp_port : 1;
    uint32  masklen     : 8;
    uint32  rsv0        : 24;
    uint32 calc_key_len[0];

    /*data*/
    uint32 new_l4_src_port  : 16;
    uint32 sa_edit_ptr      : 16;

    uint32 ad_offset        : 20;
    uint32 in_tcam          : 1 ;
    uint32 is_v6            : 1 ;
    uint32 new_ip_ver       : 1 ;
    uint32 rsv1             : 9;

    uint32 key_offset       : 20;
    uint32 rsv2             : 12;

    union
    {
        ip_addr_t ipv4;
        ipv6_addr_t ipv6;
    } new_ipsa;
};
typedef struct sys_wb_ip_tunnel_natsa_info_s sys_wb_ip_tunnel_natsa_info_t;


/****************************************************************
*
* dtel module
*
****************************************************************/
enum sys_wb_appid_dtel_subid_e
{
    SYS_WB_APPID_DTEL_SUBID_MASTER,
    SYS_WB_APPID_DTEL_SUBID_MAX

};
typedef enum sys_wb_appid_dtel_subid_e sys_wb_appid_dtel_subid_t;


#define SYS_WB_DTEL_INT_SINK_SESSION_NUM  32
#define SYS_WB_DTEL_IFA_SINK_SESSION_NUM  32
#define SYS_WB_DTEL_TIX_NH_NUM    1 /*refer to CTC_DTEL_TIX_TYPE_MAX*/
#define SYS_WB_DTEL_TSX_NH_NUM    6 /*refer t0 CTC_DTEL_TSX_TYPE_MAX*/
#define SYS_WB_DTEL_TEX_NH_NUM    3 /*refer t0 CTC_DTEL_TEX_TYPE_MAX*/
#define SYS_WB_DTEL_INT_LOG_NUM  4
typedef struct sys_wb_dtel_ifa_session_s
{
    uint8 node : 4;
    uint8 gns  : 4;
    uint8 max_length;
    uint8 hop_limit;
    uint8 req_vec;
}sys_wb_dtel_ifa_session_t;
struct sys_wb_dtel_master_s
{
    /*key*/
    uint8  lchip;
    uint32 calc_key_len[0];
    /*ad*/
    uint32 rep_id;
    uint32 switch_id;
    uint8  postcard_en;
    uint8  inband_en;
    uint32 log_en[SYS_WB_DTEL_INT_LOG_NUM][(SYS_WB_DTEL_INT_SINK_SESSION_NUM + 31)/CTC_UINT32_BITS];
    uint32 nhid[SYS_WB_DTEL_INT_SINK_SESSION_NUM];
    uint8  rep_md_bits[SYS_WB_DTEL_INT_SINK_SESSION_NUM];
    uint32 version;
    uint32 tix_nh_id[SYS_WB_DTEL_TIX_NH_NUM];
    uint32 tsx_nh_id[SYS_WB_DTEL_TSX_NH_NUM];
    uint32 tex_nh_id[SYS_WB_DTEL_TEX_NH_NUM];
    uint8  ifa_en       : 1;
    uint8  ifa_eunit_en : 1;
    uint8  rsv1         : 1;
    uint8  ifa_session_valid : 1;
    uint8  tsx_mac_stats_en : 1;
    uint8  ifa_ver          : 2;
    uint8  rsv : 1;
    uint16  dscp;
    sys_wb_dtel_ifa_session_t ifa_session[SYS_WB_DTEL_IFA_SINK_SESSION_NUM];
    uint8  ifa_protocol;
    uint8 rsv2[3];
};
typedef struct sys_wb_dtel_master_s sys_wb_dtel_master_t;

/****************************************************************
*
* ipmc module
*
****************************************************************/
#define SYS_IPMC_TYPE_MAX 4

enum sys_wb_appid_ipmc_subid_e
{
    SYS_WB_APPID_IPMC_SUBID_MASTER,
    SYS_WB_APPID_IPMC_SUBID_GROUP_NODE,
    SYS_WB_APPID_IPMC_SUBID_MAX
};
typedef enum sys_wb_appid_ipmc_subid_e sys_wb_appid_ipmc_subid_t;

struct sys_wb_ipmc_group_node_s
{
    /*key*/
    uint32  vrfid              : 16;  /**< if IP-L2MC,used as FID */
    uint32  src_ip_valid       : 1;
    uint32  group_ip_valid     : 1;
    uint32  ip_version         : 1;
    uint32  is_l2mc            : 1;
    uint32  rsv                : 12;

    uint32 group_addr[4];         /**< [HB.GB.GG] IPv4 Group address */
    uint32 src_addr[4];           /**< [HB.GB.GG]IPv4 Source address. Byte 0 and 1 indicate the pointer field when (*.g) */

    uint32 calc_key_len[0];

    /*data*/
    uint16 ad_index;
    uint16 group_id;
    uint32 share_grp:1;
    uint32 is_drop:1;
    uint32 with_nexthop:1;
    uint32 is_group:1;
    uint32 is_rd_cpu:8;
    uint32 rsv1:20;
};
typedef struct sys_wb_ipmc_group_node_s sys_wb_ipmc_group_node_t;


struct sys_wb_ipmc_master_s
{
    /*key*/
    uint32 lchip;   /*lchip*/
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    uint32 ipmc_group_cnt[SYS_IPMC_TYPE_MAX];
    uint32 ipmc_group_sg_cnt[SYS_IPMC_TYPE_MAX];
    uint8 bidipim_mode;
};
typedef struct sys_wb_ipmc_master_s sys_wb_ipmc_master_t;

/****************************************************************
*
* scl module
*
****************************************************************/
#define SYS_WB_SCL_MAX_KEY_SIZE_IN_WORD  24
#define SYS_WB_SCL_FIELD_ACTION_TYPE_MAX 128

enum sys_wb_appid_scl_subid_e
{
    SYS_WB_APPID_SCL_SUBID_MASTER,
    SYS_WB_APPID_SCL_SUBID_GROUP,
    SYS_WB_APPID_SCL_SUBID_IGS_HASH_ENTRY,
    SYS_WB_APPID_SCL_SUBID_IGS_TCAM_ENTRY,
    SYS_WB_APPID_SCL_SUBID_EGS_HASH_ENTRY,
    SYS_WB_APPID_SCL_SUBID_DEFAULT_ENTRY,
    SYS_WB_APPID_SCL_SUBID_FLEX_KEY,
    SYS_WB_APPID_SCL_SUBID_MAX
};
typedef enum sys_wb_appid_scl_subid_e sys_wb_appid_scl_subid_t;

struct sys_wb_scl_master_s
{
    /*key*/
    uint32   lchip;
    uint8    block_id;
    uint8    key_size_type;
    uint32   calc_key_len[0];

    /*data*/
    uint32    version;
    uint16    start_offset;
    uint16    sub_entry_count;
    uint16    sub_free_count;
};
typedef struct sys_wb_scl_master_s sys_wb_scl_master_t;

struct sys_wb_scl_group_s
{
    /*key*/
    uint32  group_id;
    uint32  calc_key_len[0];

    /*data*/

    uint32  type     :8;
    uint32  priority :8;        /* group priority */
    uint32  rsv      :16;
    uint32  gport;           /* port_class_id/gport/logic_port */
};
typedef struct sys_wb_scl_group_s sys_wb_scl_group_t;

struct sys_wb_scl_igs_hash_entry_s
{
    /*key*/
    uint32 entry_id;
    uint32 calc_key_len[0];
    /*data*/

    uint32       key_type             : 8; /* sys_scl_key_type_t/sys_scl_tunnel_type_t: SCL Hash/Tunnel Hash/TCAM */
    uint32       resolve_conflict     : 1;
    uint32       is_half              : 1;
    uint32       uninstall            : 1;
    uint32       u1_type              : 3;
    uint32       u2_type              : 3;
    uint32       u3_type              : 3;
    uint32       u4_type              : 3;
    uint32       u5_type              : 3;
    uint32       is_service_policer   : 1;
    uint32       bind_nh              : 1;
    uint32       acl_profile_valid    : 1;
    uint32       fwd_bmp              : 3;
    uint32       is_scl               : 1;
    uint32       rsv2                 : 2;

    uint32       l3_type              : 4;
    uint32       l4_type              : 4;
    uint32       action_type          : 3;       /* sys_scl_action_type_t:DsUserid/Egress/DsTunnel/DsSclFlow */
    uint32       fwd_type             : 2;
    uint32       ad_type              : 3;
    uint32       userid_bmp           : 8;
	uint32       hash_field_sel_id    : 8;
    uint32       hash_valid           : 1;             /* generated hash index */
    uint32       vrange_gid           : 6;
    uint32       is_xkey              : 1;

    uint32 key_index      :20;
    uint32 priority       :2;
    uint32 rsv            :10;

    uint32 group_id;
    uint32 nexthop_id;
    uint32 key_bmp;

    uint32 service_id    :16;
    uint32 rsv1          :16;

    uint32 action_bmp[CTC_B2W_SIZE(SYS_WB_SCL_FIELD_ACTION_TYPE_MAX)];
};
typedef struct sys_wb_scl_igs_hash_entry_s sys_wb_scl_igs_hash_entry_t;

struct sys_wb_scl_igs_tcam_entry_s
{
    /*key*/
    uint32 entry_id;
    uint32 calc_key_len[0];
    /*data*/

    uint32       key_type             : 8;                              /* sys_scl_key_type_t/sys_scl_tunnel_type_t: SCL Hash/Tunnel Hash/TCAM */
    uint32       userid_bmp           : 8;
    uint32       l3_type              : 4;
    uint32       l4_type              : 4;
    uint32       u1_type              : 3;
    uint32       u2_type              : 3;
    uint32       rsv2                 : 2;

    uint32       u3_type              : 3;
    uint32       u4_type              : 3;
    uint32       u5_type              : 3;
    uint32       is_service_policer   : 1;
    uint32       bind_nh              : 1;
    uint32       fwd_bmp              : 3;
    uint32       action_type          : 3;       /* sys_scl_action_type_t:DsUserid/Egress/DsTunnel/DsSclFlow */
    uint32       fwd_type             : 2;
    uint32       ad_type              : 3;
    uint32       l2_type              : 4;
    uint32       l4_user_type         : 4;
    uint32       key_l4_port_mode     : 2;             /* 0:none, 1:l4port, 2:vxlan, 3:gre */

    uint32       acl_profile_valid    : 1;
    uint32       service_id           : 16;
    uint32       ether_type_index     : 8;
    uint32       mac_key_vlan_mode    : 2;
    uint32       mac_key_macda_mode   : 2;
    uint32       is_xkey              : 1;
    uint32       ether_type_valid     : 1;
	uint32       rsv                  : 1;

    uint32 key_index      :20;
    uint32 rsv1           :12;

    uint32 group_id;
    uint32 nexthop_id;
    uint32 key_bmp;
    uint32 priority;
    uint32 action_bmp[CTC_B2W_SIZE(SYS_WB_SCL_FIELD_ACTION_TYPE_MAX)];
};
typedef struct sys_wb_scl_igs_tcam_entry_s sys_wb_scl_igs_tcam_entry_t;

struct sys_wb_scl_egs_entry_s
{
    /*key*/
    uint32 entry_id;
    uint32 calc_key_len[0];
    /*data*/
    uint32       resolve_conflict     : 1;
    uint32       u1_type              : 3;
    uint32       is_service_policer   : 1;
    uint32       action_type          : 3;        /* sys_scl_action_type_t:DsUserid/Egress/DsTunnel/DsSclFlow */
    uint32       key_type             : 8;        /* sys_scl_key_type_t/sys_scl_tunnel_type_t: SCL Hash/Tunnel Hash/TCAM */
    uint32       is_xkey              : 1;
    uint32       hash_valid           : 1;             /* generated hash index */
    uint32       uninstall            : 1;
    uint32       rsv0                 : 13;

    uint32       key_index            :20;
    uint32       priority             :2;
    uint32       rsv1                 :10;

    uint32 key_bmp;
    uint32 group_id;
    uint32 action_bmp[CTC_B2W_SIZE(SYS_WB_SCL_FIELD_ACTION_TYPE_MAX)];
};
typedef struct sys_wb_scl_egs_entry_s sys_wb_scl_egs_entry_t;

typedef struct sys_wb_scl_kset_s {
    uint32 w[CTC_B2W_SIZE(SYS_WB_SCL_FIELD_COUNT)];
} sys_wb_scl_kset_t;

struct sys_wb_scl_flex_key_s
{
    /*key*/
    uint8 key_type        ;
    uint32 calc_key_len[0];

    /*data*/
    uint32 origin_key_type :8;
    uint32 dir             :1;
    uint32 key_size        :8;
    uint32 is_xkey         :1;
    uint32 is_replace      :1;
    uint32 rsv             :13;
    sys_wb_scl_kset_t kset;
};
typedef struct sys_wb_scl_flex_key_s sys_wb_scl_flex_key_t;


/****************************************************************
*
* ipfix module
*
****************************************************************/
enum sys_wb_appid_ipfix_subid_e
{
    SYS_WB_APPID_IPFIX_SUBID_MASTER,
    SYS_WB_APPID_IPFIX_SUBID_XALU_VEC,
    SYS_WB_APPID_IPFIX_SUBID_XKEY_VEC,
    SYS_WB_APPID_IPFIX_SUBID_MAX
};
typedef enum sys_wb_appid_ipfix_subid_e sys_wb_appid_ipfix_subid_t;

struct sys_wb_ipfix_master_s
{
    /*key*/
    uint8   lchip;
    uint8   rsv[3];
    uint32  calc_key_len[0];

    /*data*/
    uint32  version;
    uint32  max_ptr;
    uint32  aging_interval;
    uint32  export_interval;
    uint32  sip_interval[8];
    uint32  short_mode          :1;
    uint32  ignore_drop_reason  :1;
    uint32  max_export_entry_num :16;
    uint32  rsv1 :14;
};
typedef struct sys_wb_ipfix_master_s sys_wb_ipfix_master_t;

struct sys_wb_ipfix_xalu_vec_s
{
    /*key*/
    uint32 flow_cfg_id;
    uint32 calc_key_len[0];
    /*data*/
    uint8 xalu_type[8];
};
typedef struct sys_wb_ipfix_xalu_vec_s sys_wb_ipfix_xalu_vec_t;

struct sys_wb_ipfix_xkey_vec_s
{
    /*key*/
    uint32 key_type;
    uint32 dir;
    uint32 calc_key_len[0];
    /*data*/
    uint32  origin_key_type;
    uint32  key_size;
    uint32  mode;
    uint32 w[CTC_B2W_SIZE(CTC_FIELD_KEY_NUM)];
};
typedef struct sys_wb_ipfix_xkey_vec_s sys_wb_ipfix_xkey_vec_t;

/****************************************************************
*
* linkagg module
*
****************************************************************/
enum sys_wb_appid_linkagg_subid_e
{
    SYS_WB_APPID_LINKAGG_SUBID_MASTER,
    SYS_WB_APPID_LINKAGG_SUBID_GROUP,
    SYS_WB_APPID_LINKAGG_SUBID_CHANGROUP,
    SYS_WB_APPID_LINKAGG_SUBID_MEMBER,
    SYS_WB_APPID_LINKAGG_SUBID_MAX
};
typedef enum sys_wb_appid_linkagg_subid_e sys_wb_appid_linkagg_subid_t;

struct sys_wb_linkagg_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    uint8 linkagg_mode;
    uint8 tx_load_percent;
    uint8 rsv[2];
};
typedef struct sys_wb_linkagg_master_s sys_wb_linkagg_master_t;

struct sys_wb_linkagg_port_s
{
    uint8 valid;        /* 1: member port is in linkAgg group */
    uint32 gport;       /* member port */
};
typedef struct sys_wb_linkagg_port_s sys_wb_linkagg_port_t;

struct sys_wb_linkagg_group_s
{
    /*key*/
    uint32 tid;              /* linkAggId */
    uint32 calc_key_len[0];

    /*data*/
    uint16   flag;
    uint16   max_member_num;
    uint8    mode;             /* ctc_linkagg_group_mode_t */
    uint8    ref_cnt;          /*for channel linkagg, bpe cb cascade*/
    uint8    lsh_mode;
    uint8    is_lag          :1,
             is_lmpf_cancel   :1,
             rsv              :6;
};
typedef struct sys_wb_linkagg_group_s sys_wb_linkagg_group_t;

struct sys_wb_linkagg_member_s
{
    /*key*/
    uint32 gport;
    uint8  is_channel_grp;
    uint8  position;
    uint32 calc_key_len[0];

    /*data*/
    uint32   tid:16;
    uint32   valid:1;
    uint32   nonuc_block_en :1;
    uint32   rsv:14;
};
typedef struct sys_wb_linkagg_member_s sys_wb_linkagg_member_t;

/****************************************************************
*
* overlay tunnel module
*
****************************************************************/
#define SYS_OVERLAT_TUNNEL_MAX_IP_INDEX       4

enum sys_wb_appid_overlay_tunnel_subid_e
{
    SYS_WB_APPID_OVERLAY_SUBID_TUNNEL_MASTER,
    SYS_WB_APPID_OVERLAY_SUBID_MAX
};
typedef enum sys_wb_appid_overlay_tunnel_subid_e sys_wb_appid_overlay_tunnel_subid_t;

struct sys_wb_overlay_tunnel_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    uint32 ipda_index_cnt[SYS_OVERLAT_TUNNEL_MAX_IP_INDEX];
    uint32 could_sec_en     :1;
    uint32 rsv              :31;
};
typedef struct sys_wb_overlay_tunnel_master_s sys_wb_overlay_tunnel_master_t;

enum sys_wb_appid_aps_subid_e
{
    SYS_WB_APPID_APS_SUBID_MASTER,
    SYS_WB_APPID_APS_SUBID_NODE,
    SYS_WB_APPID_APS_SUBID_MAX
};
typedef enum sys_wb_appid_aps_subid_e sys_wb_appid_aps_subid_t;

struct sys_wb_aps_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];

    /**data */
    uint32 version;
};
typedef struct sys_wb_aps_master_s sys_wb_aps_master_t;

struct sys_wb_aps_node_s
{
    /*key*/
    uint16  group_id;
    uint16  rsv;
    uint32  calc_key_len[0];

    /*data*/
    uint16 w_l3if_id;                   /**< working l3if id */
    uint16 p_l3if_id;                   /**< protection l3if id */
    uint16 raps_group_id;
    uint16 flag;                        /**< it's the sys_aps_flag_t value */
    uint32 nh_id;
    uint32 met_offset;
    uint16 w_dest_id;
    uint16 p_dest_id;
};
typedef struct sys_wb_aps_node_s sys_wb_aps_node_t;

/****************************************************************
*
* stats module
*
****************************************************************/
//#define SYS_STATS_RAM_MAX 15
#define SYS_WB_STATS_TYPE_MAX 27
#define SYS_WB_STATS_RAM_NUM_TMM 58
#define SYS_WB_STATS_MAC_RCV_NUM 22
#define SYS_WB_STATS_MAC_SEND_NUM 18
#define SYS_WB_STATS_XQMAC_PORT_MAX 4u

enum sys_wb_appid_stats_subid_e
{
    SYS_WB_APPID_STATS_SUBID_MASTER,
    SYS_WB_APPID_STATS_SUBID_STATSID,
    SYS_WB_APPID_STATS_SUBID_MAX
};
typedef enum sys_wb_appid_stats_subid_e sys_wb_appid_stats_subid_t;

struct sys_wb_stats_prop_s
{
    uint64 ram_bmp;
};
typedef struct sys_wb_stats_prop_s sys_wb_stats_prop_t;

struct sys_wb_stats_ram_s
{
    uint32 stats_bmp[CTC_BOTH_DIRECTION];
    uint32 acl_priority:8;
    uint32 scl_bmp:4;
    uint32 rsv:20;
};
typedef struct sys_wb_stats_ram_s sys_wb_stats_ram_t;

struct sys_wb_stats_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];

    /*data*/
    uint32                 version;
    sys_wb_stats_prop_t    stats_type[CTC_BOTH_DIRECTION][SYS_WB_STATS_TYPE_MAX];
    sys_wb_stats_ram_t     stats_ram[SYS_WB_STATS_RAM_NUM_TMM];
};
typedef struct sys_wb_stats_master_s sys_wb_stats_master_t;

struct sys_wb_stats_statsid_s
{
    /*key*/
    uint32 stats_id;
    uint32 calc_key_len[0];

    /*data*/
    uint32 stats_ptr;
    uint32 stats_id_type    :6;
    uint32 dir              :1;
    uint32 color_aware      :1;
    uint32 acl_priority     :7;
    uint32 is_vc_label      :1;
    uint32 stats_ptr_valid  :1;
    uint32 egs_stats_ptr_valid:1;
    uint32 rsv              :14;
    uint32 egs_stats_ptr;
};
typedef struct sys_wb_stats_statsid_s sys_wb_stats_statsid_t;

/****************************************************************
*
* mirror module
*
****************************************************************/
enum sys_wb_appid_mirror_subid_e
{
    SYS_WB_APPID_MIRROR_SUBID_MASTER,
    SYS_WB_APPID_MIRROR_SUBID_DEST,
    SYS_WB_APPID_MIRROR_SUBID_MAX
};
typedef enum sys_wb_appid_mirror_subid_e sys_wb_appid_mirror_subid_t;

struct sys_wb_mirror_master_s
{
    /* key */
    uint32 lchip;
    uint32 calc_key_len[0];

    /* data */
    uint32 version;
};
typedef struct sys_wb_mirror_master_s sys_wb_mirror_master_t;

struct sys_wb_mirror_dest_s
{
   /*key*/
   uint8 type;
   uint8 dir;
   uint8 session_id;
   uint8 member_index;
   uint32 calc_key_len[0];

   /*data*/
   uint32 nh_id;
   uint16 loop_port;
   uint16 linkagg_id;
   uint8 data_type;
};
typedef struct sys_wb_mirror_dest_s sys_wb_mirror_dest_t;

/****************************************************************
*
* ofb module
*
****************************************************************/
struct sys_wb_ofb_s
{
   /*key*/
   uint8 type;
   uint8 ofb_type;
   uint16 block_id;
   uint32 calc_key_len[0];

   /*data*/
   uint32      all_left_b; /* left unused boundary */
   uint32      all_right_b;    /* right unused boundary */
   uint32      all_of_num;   /*the number of all offset */
   uint8 adj_dir; /*for empty_grow*/
};
typedef struct sys_wb_ofb_s sys_wb_ofb_t;

/****************************************************************
*
* ptp module
*
****************************************************************/
/* refer to ctc_ptp_device_type_t */
enum sys_wb_ptp_device_type_e
{
    SYS_WB_PTP_DEVICE_NONE = 0,
    SYS_WB_PTP_DEVICE_OC,
    SYS_WB_PTP_DEVICE_BC,
    SYS_WB_PTP_DEVICE_E2E_TC,
    SYS_WB_PTP_DEVICE_P2P_TC,

    MAX_SYS_WB_PTP_DEVICE
};
typedef enum sys_wb_ptp_device_type_e sys_wb_ptp_device_type_t;

enum sys_wb_appid_ptp_subid_e
{
    SYS_WB_APPID_PTP_SUBID_MASTER,
    SYS_WB_APPID_PTP_SUBID_SESSION,
    SYS_WB_APPID_PTP_SUBID_MAX
};
typedef enum sys_wb_appid_ptp_subid_e sys_wb_appid_ptp_subid_t;

struct sys_wb_ptp_session_s
{
    uint32 nhid1;
    uint32 nhid2;
    uint32 gport;
};
typedef struct sys_wb_ptp_session_s sys_wb_ptp_session_t;

struct sys_wb_ptp_master_s
{
    /* key */
    uint32 lchip;
    uint32 calc_key_len[0];

    /* data */
    uint32 version;
    uint8 quanta;
    uint8 intf_selected;
    uint16 cache_aging_time;
    sys_wb_ptp_device_type_t device_type;
    uint8 tod_1pps_duty;
    uint8 tod_1pps_mode;
    uint8 tod_1pps_flex_en;
    uint8 rsv;
    uint32 tod_1pps_delay;
    uint32 drift_nanoseconds;
    uint32 tod_1pps_thrd;
    uint32 tod_1pps_delay_nano_ns;
    uint64 session_en_bmp[2];
    uint8  ptp_opf_type;
};
typedef struct sys_wb_ptp_master_s sys_wb_ptp_master_t;

struct sys_wb_ptp_session_info_s
{
    /*key*/
    uint32 index;
    uint32 calc_key_len[0];

    /*data*/
    sys_wb_ptp_session_t session;
};
typedef struct sys_wb_ptp_session_info_s sys_wb_ptp_session_info_t;

/****************************************************************
*
* sync_ether module
*
****************************************************************/
/* DUET2 IS 2; TM IS 3 */
#define SYS_WB_SYNCETHER_CLOCK_MAX 3

enum sys_wb_appid_syncether_subid_e
{
    SYS_WB_APPID_SYNCE_SUBID_MASTER,
    SYS_WB_APPID_SYNCE_SUBID_MAX
};
typedef enum sys_wb_appid_syncether_subid_e sys_wb_appid_syncether_subid_t;

struct sys_wb_syncether_master_s
{
    /* key */
    uint32 lchip;
    uint32 calc_key_len[0];

    /* data */
    uint32 version;
    uint8 recovered_clock_lport[SYS_WB_SYNCETHER_CLOCK_MAX];
};
typedef struct sys_wb_syncether_master_s sys_wb_syncether_master_t;


/****************************************************************
*
* qos module
*
****************************************************************/
#define SYS_WB_CHAN_NUM 256

enum sys_wb_appid_qos_subid_e
{
    SYS_WB_APPID_QOS_SUBID_MASTER,
    SYS_WB_APPID_QOS_SUBID_POLICER,
    SYS_WB_APPID_QOS_SUBID_QUEUE_MASTER,
    SYS_WB_APPID_QOS_SUBID_QUEUE_QUEUE_NODE,
    SYS_WB_APPID_QOS_SUBID_QUEUE_GROUP_NODE,
    SYS_WB_APPID_QOS_SUBID_QUEUE_FC_PROFILE,
    SYS_WB_APPID_QOS_SUBID_QUEUE_PFC_PROFILE,
    SYS_WB_APPID_QOS_SUBID_QUEUE_PORT_EXTENDER,
    SYS_WB_APPID_QOS_SUBID_CPU_REASON,
    SYS_WB_APPID_QOS_SUBID_QUEUE_FC_DROPTH_PROFILE,
    SYS_WB_APPID_QOS_SUBID_QUEUE_PFC_DROPTH_PROFILE,
    SYS_WB_APPID_QOS_SUBID_QUEUE_LOGIC_SRC_PORT,
    SYS_WB_APPID_QOS_SUBID_QUEUE_DESTPORT,
    SYS_WB_APPID_QOS_SUBID_QUEUE_SCH_GROUP_NODE,
    SYS_WB_APPID_QOS_SUBID_QUEUE_OOBFC_PROFILE,
    SYS_WB_APPID_QOS_SUBID_POLICER_SVC,
    SYS_WB_APPID_QOS_SUBID_QUEUE_FCDL,

    SYS_WB_APPID_QOS_SUBID_MAX
};
typedef enum sys_wb_appid_qos_subid_e sys_wb_appid_qos_subid_t;

struct sys_wb_qos_master_s
{
    /* key */
    uint32 lchip;
    uint32 calc_key_len[0];

    /* data */
    uint32 version;
};
typedef struct sys_wb_qos_master_s sys_wb_qos_master_t;

struct sys_wb_qos_policer_s
{
    /* key */
    uint8  type; /*ctc_qos_policer_type_t*/
    uint8  dir;   /*ctc_direction_t */
    uint16 id;
    uint32 calc_key_len[0];

    /* data */

    uint32 level                  : 2,
           split_en               : 1,
           hbwp_en                : 1,
           is_pps                 : 1,
           cos_index              : 3,
           sf_en                  : 1,
           cf_total_dis           : 1,
           cf_en                  : 1,
           is_color_aware         : 1,
           use_l3_length          : 1,
           drop_color             : 2,
           stats_en               : 1,
           stats_mode             : 2,
           stats_num              : 3,
           color_merge_mode       : 2,
           policer_mode           : 3,
           glb_policer            : 1,
           sys_policer_type       : 4,
           rsv1                   : 1;

    uint32 policer_lvl                  : 2,
           stats_ptr_alloc              : 1,
           prio_green                   : 4,
           prio_yellow                  : 4,
           prio_red                     : 4,
           is_installed                 : 1,
           gran                         : 16;


    uint32 cir;
    uint32 cbs;

    uint32 pir;
    uint32 pbs;

    uint32 cir_max;
    uint32 pir_max;

    uint32 flag         : 8,       /*refer to ctc_qos_policer_action_flag_t*/
           cos_bitmap   : 8,       /*bitmap of hbwp enable*/
           policer_ptr  : 16;
};
typedef struct sys_wb_qos_policer_s sys_wb_qos_policer_t;

struct sys_wb_qos_policer_svc_s
{
    /* key */
    uint32 type   : 8,
           id     : 16,
           rsv    : 8 ;
    uint32 calc_key_len[0];

    /* data */
    uint32 is_pps                 : 1,
           cf_en                  : 1,
           is_color_aware         : 1,
           use_l3_length          : 1,
           stats_mode             : 2,
           policer_mode           : 8,
           policer_ptr            : 16,
           rsv0                   : 2;
};
typedef struct sys_wb_qos_policer_svc_s sys_wb_qos_policer_svc_t;

#define SYS_QOS_QUEUE_MODE_NUM 52
struct sys_wb_qos_queue_master_s
{
    /* key */
    uint32 lchip;
    uint32 calc_key_len[0];

    /* data */
    uint32 store_chan_shp_en : 1,
           store_que_shp_en  : 1,
           monitor_drop_en   : 1,
           shp_pps_en        : 1,
           net_shp_pps_en    : 1,
           fcdl_action       : 2,
           rsv               : 25;

    uint8 group_bmp_ets[SYS_WB_CHAN_NUM];
    uint32 group_id_ets[SYS_WB_CHAN_NUM];
    uint32 oobfc_port_base;
    uint16 oobfc_port_num;
    uint8 oobfc_port_offset;
    uint8 oobfc_group_num;
    uint32 oobfc_id_bmp[8];
    uint32 l3_group_id[SYS_WB_CHAN_NUM];
};
typedef struct sys_wb_qos_queue_master_s sys_wb_qos_queue_master_t;

struct sys_wb_qos_queue_group_node_s
{
    /* key */
    uint16 group_id;
    uint8 rsv[2];
    uint32 calc_key_len[0];

    /* data */
    uint32 chan_id                : 16,
           shp_bitmap             : 16;
};
typedef struct sys_wb_qos_queue_group_node_s sys_wb_qos_queue_group_node_t;

struct sys_wb_qos_queue_sch_group_node_s
{
    /* key */
    uint32 grp_index  : 16,
           chan_valid : 1,
           chan_id    : 8,
           rsv        : 7;
    uint32 calc_key_len[0];

    /* data */
    uint32 parent_id;
};
typedef struct sys_wb_qos_queue_sch_group_node_s sys_wb_qos_queue_sch_group_node_t;

struct sys_wb_qos_queue_fc_profile_s
{
    /* key */
    uint32 chan_id            : 16,
           fc_profile_id      : 8,
           rsv                : 8;
    uint32 calc_key_len[0];

    /* data */
    uint32 xon;
    uint32 xoff;
};
typedef struct sys_wb_qos_queue_fc_profile_s sys_wb_qos_queue_fc_profile_t;

struct sys_wb_qos_queue_pfc_profile_s
{
    /* key */
    uint32 chan_id            : 16,
           priority_class     : 4,
           pfc_profile_id     : 8,
           rsv                : 4;
    uint32 calc_key_len[0];

    /* data */
    uint32 xon;
    uint32 xoff;
};
typedef struct sys_wb_qos_queue_pfc_profile_s sys_wb_qos_queue_pfc_profile_t;

struct sys_wb_qos_queue_oobfc_profile_s
{
    /* key */
    uint8 chan_id;
    uint8 rsv[3];
    uint32 calc_key_len[0];

    /* data */
    uint8 profile_id;
};
typedef struct sys_wb_qos_queue_oobfc_profile_s sys_wb_qos_queue_oobfc_profile_t;

struct sys_wb_qos_queue_port_extender_s
{
    /* key */
    uint8  lchip;
    uint8 dir;
    uint16 lport;
    uint8 channel;
    uint8 type;     /** sys_extend_que_type_t */
    uint16 service_id;
    uint16 logic_src_port;
    uint16 rsv1;
    uint32 calc_key_len[0];

    /* data */
    uint32 group_id  : 16,
           key_index : 16;

    uint32 logic_dst_port : 16,
           group_is_alloc : 8,
           rsv2           : 8;

    uint32 nexthop_ptr;
    uint32 queue_id       : 16,
           rsv3           : 16;
};
typedef struct sys_wb_qos_queue_port_extender_s sys_wb_qos_queue_port_extender_t;

struct sys_wb_qos_cpu_reason_s
{
    /* key */
    uint16 reason_id;
    uint8 rsv[2];
    uint32 calc_key_len[0];

    /* data */
    uint32 nh_id;
    uint32 dest_type          : 4,
           user_define_mode0  : 2, /* ingress 0-none;1-DsFwd/ misc nexthop;2.alloc excep ID*/
           user_define_mode1  : 2, /* egress 0-none;1-DsFwd/ misc nexthop;2.alloc excep ID*/
           dir                : 4,
           tcat_prof_id       : 4,
           sub_index          : 3,
           raw_dest_en        : 1,
           rsv1               : 12;
    uint32 excp_id1           : 16,
           rsv2               : 16;
    uint16 sub_queue_id;
    uint16 excp_id0;
    uint32 dest_port;
    uint16 policer_id[2];
};
typedef struct sys_wb_qos_cpu_reason_s sys_wb_qos_cpu_reason_t;

struct sys_wb_qos_queue_fcdl_s
{
    /* key */
    uint16 lport;
    uint16 rsv0;
    uint32 calc_key_len[0];

    /* data */
    uint32 timeout;
    uint32 mode      : 4,
           rsv1      : 28;
};
typedef struct sys_wb_qos_queue_fcdl_s sys_wb_qos_queue_fcdl_t;


struct sys_wb_qos_logicsrc_port_s
{
    /* key */
    uint16 service_id;
    uint16 logic_src_port;
    uint32 calc_key_len[0];

    /* data */
};
typedef struct sys_wb_qos_logicsrc_port_s sys_wb_qos_logicsrc_port_t;

struct sys_wb_qos_destport_s
{
    /* key */
    uint16 service_id;
    uint16 lport;
    uint32 calc_key_len[0];

    /* data */
};
typedef struct sys_wb_qos_destport_s sys_wb_qos_destport_t;

enum sys_wb_appid_security_subid_e
{
    SYS_WB_APPID_SECURITY_SUBID_MASTER,
    SYS_WB_APPID_SECURITY_SUBID_HMAC_SHA_KEY,

    SYS_WB_APPID_SECURITY_SUBID_MAX
};
typedef enum sys_wb_appid_security_subid_e sys_wb_appid_security_subid_t;

struct sys_wb_security_master_s
{
    /* key */
    uint32 lchip;
    uint32 calc_key_len[0];

    /* data */
    uint32 version;
    uint32 ipsg_flag         : 8,
           rsv               : 8,
           tcam_group0       : 2,
           tcam_group1       : 2,
           hash_group0       : 2,
           hash_group1       : 2,
           mstorm_mode       : 8;
};
typedef struct sys_wb_security_master_s sys_wb_security_master_t;


struct sys_wb_security_hmac_key_s
{
    /* key */
    uint32  hmac_id;
    uint32 calc_key_len[0];

    /* data */
    uint32  key_index;
};
typedef struct sys_wb_security_hmac_key_s sys_wb_security_hmac_key_t;

/****************************************************************
*
* datapath module
*
****************************************************************/
enum sys_wb_appid_datapath_subid_e
{
    SYS_WB_APPID_DATAPATH_SUBID_MASTER,
    SYS_WB_APPID_DATAPATH_SUBID_HSS_ATTRIBUTE,
    SYS_WB_APPID_DATAPATH_SUBID_MAX
};
typedef enum sys_wb_appid_datapath_subid_e sys_wb_appid_datapath_subid_t;

/****************************************************************
*
* flexe module
*
****************************************************************/
enum sys_wb_appid_flexe_subid_e
{
    SYS_WB_APPID_FLEXE_SUBID_MASTER,
    SYS_WB_APPID_FLEXE_SUBID_GROUP,
    SYS_WB_APPID_FLEXE_SUBID_CLIENT,
    SYS_WB_APPID_FLEXE_SUBID_GROUP_MEM,
        
    SYS_WB_APPID_FLEXE_SUBID_MAX
};
typedef enum sys_wb_appid_flexe_subid_e sys_wb_appid_flexe_subid_t;

struct sys_wb_datapath_lport_attr_s
{
    uint8 port_type;  /*refer to sys_dmps_lport_type_t */
    uint16 mac_id;           /* for TMM, uint8(0~255) is not enough!! So we expand it to uint16 */
    uint16 chan_id;
    uint8 speed_mode;  /*refer to sys_port_speed_t, only usefull for network port*/

    uint8 slice_id;
    uint8 serdes_num;  /*serdes num of port*/
    uint8 pcs_mode; /*refer to ctc_chip_serdes_mode_t*/
    uint8 serdes_id;
    uint8 multi_serdes_id[8];  /* TMM only */

    uint8 is_serdes_dyn;
    uint8 is_first;   /* 40G/100G, 4 interrupts will process the first*/
    uint8 flag;       /* for D2 50G, if serdes lane 0/1 and 2/3 form 50G port, flag is eq to 0;
                                     if serdes lane 2/1 and 0/3 form 50G port, flag is eq to 1; */
    uint8 interface_type;    /* refer to ctc_port_if_type_t */

    uint8 an_fec;      /* refer to ctc_port_fec_type_t */
    uint8 code_err_count;   /* code error count*/
    uint8 pcs_reset_en;
    uint8 tbl_id;           /*TM ONLY  table id for mac table 0~71*/

    uint8 sgmac_idx;
    uint8 mii_idx;
    uint8 pcs_idx;
    uint8 internal_mac_idx;

    uint8 first_led_mode;
    uint8 sec_led_mode;

    uint8 xpipe_en;
    uint16 pmac_id;
    uint16 emac_id;
    uint8 pmac_chanid;
    uint8 emac_chanid;
    uint8 txqm_id;            /* TMM only */
    uint8 q_credit;           /* TMM only */

    uint8 an_done_opr;        /* TMM only   CL73 AN complete processing flag. 1-CL73 complete is processing 0-no CL73 complete or finished*/

    sys_datapath_an_ability_t an_ability;	/* TMM only */
    uint32 speed_value;        /* TMM only, for FlexE speed value, such as 5(G), 30(G), 100(G), 230(G) etc */
    uint16 mac_id_reserve;     /* TMM only, for FlexE <-> Ethernet switch */
    uint16 mac_id_aps;         /* TMM only, for FlexE aps */
    uint8  client_bind_num;    /* TMM only, for FlexE client binded port num */
    uint8  flexe_mactx_encfg;
    uint8  flexe_macrx_encfg;
    uint8  lt_done_num;
    uint8  flexe_en;           /* TMM only, for Ethernet port flexe enable flag, reserved lport */
    uint16 flexe_client;       /* TMM only, for indicate working FlexE client */
    uint16 flexe_client_aps;   /* TMM only, for indicate protected FlexE client */
};
typedef struct sys_wb_datapath_lport_attr_s sys_wb_datapath_lport_attr_t;

struct sys_wb_datapath_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];
    /*data*/
    uint32 version;
    sys_wb_datapath_lport_attr_t port_attr[SYS_MAX_LOCAL_SLICE_NUM][512];
    sys_datapath_qm_choice_t qm_choice;     /*for TM only*/
    uint8  serdes_mac_map[4][32];           /*for TM only*/
    uint16 mii_lport_map[4][32];            /*for TM only*/
    uint8  glb_xpipe_en;            /*for TM and later*/
    sys_resource_manage_t resource_manage;  /*TMM only*/
    sys_channel_2_logic_serdes_map_t chan_2_logic_serdes[2][128]; /*TMM only*/
    uint8  cpumac_dp0_network_en;      /*for TMM only*/
    uint8  cpumac_dp1_network_en;      /*for TMM only*/
    uint8  bpe_full_mode;      /*for TMM only*/
    uint8  hscs_down_flag[2][4]; /*if current hs/cs need power down, [0]HS [1]CS  TRUE-do power down FALSE-normal cfg*/
    uint8  fec2pcs_hs_map[16][4]; /*TMM only, [0~15]fec index  [0~3]pcsx16 id  value~pcs id*/
    uint8  fec2pcs_cs_map[8][4]; /*TMM only, [0~7]fec index  [0~3]pcsx8 id  value~pcs id*/
    uint16 ext_lport_map[512];    /*TMM only, [0~255]ext lport, value~lport*/
};
typedef struct sys_wb_datapath_master_s sys_wb_datapath_master_t;

struct sys_wb_datapath_serdes_info_s
{
    uint8 mode;        /*pcs mode, refer to ctc_chip_serdes_mode_t*/
    uint8 pll_sel;       /* 0: disable,1:plla. 2:pllb    for TM it means cmu_id+1, 0: disable, 1: plla(CMU0), 2: pllb(CMU1), 3: pllc(CMU2) */
    uint8 rate_div;     /*0: full, 1:1/2, 2:1/4, 3:1/8*/
    uint8 bit_width;   /* bit width*/
    uint16 lport;        /*chip local phy port*/
    uint8 port_num;  /*serdes port count  TMM lport & channel number*/
    uint8 rx_polarity;  /*0:normal, 1:reverse*/
    uint8 tx_polarity;  /*0:normal, 1:reverse*/
    uint8 lane_id;  /*serdes internal lane id, fot TMM, this means logical lane id */
    uint8 is_dyn;
    uint8 group;
    uint16 overclocking_speed; /*serdes over clock*/
    uint8 physical_serdes_id;  /*real serdes id    for TMM only*/
    uint8 pcs_l_id;
    uint16 chan_id;
    uint8 fec_type;   /* the same value as ctc_port_fec_type_t */
    uint8 modulation_mode;    /*PAM4 or NRZ      for TMM only*/
    uint8 flexe_flag;
    uint8 optical_mode;    /*for TMM only*/
    uint32 phy_number;    /*for TMM FlexE only, 0 is illegal*/
};
typedef struct sys_wb_datapath_serdes_info_s   sys_wb_datapath_serdes_info_t;

struct sys_wb_datapath_hss_attribute_s
{
    /*key*/
    uint32 hss_idx;
    uint32 calc_key_len[0];
    /*data*/
    uint8 hss_type;   /*0:Hss15G, 1:Hss28G, refer sys_datapath_hss_type_t*/
    uint8 hss_id;        /*for hss15g is 0~9, for hss28g is 0~3*/
    uint8 plla_mode;  /*refer to sys_datapath_hssclk_t */
    uint8 pllb_mode;  /*refer to sys_datapath_hssclk_t */
    uint8 pllc_mode;  /*(TM ONLY) refers to sys_datapath_12g_cmu_type_t*/
    uint8 core_div_a[SYS_DATAPATH_CORE_NUM];  /*refer to sys_datapath_clktree_div_t, usefull plla is used*/
    uint8 core_div_b[SYS_DATAPATH_CORE_NUM];  /*refer to sys_datapath_clktree_div_t, usefull plla is used*/
    uint8 intf_div_a;   /*refer to sys_datapath_clktree_div_t, usefull pllb is used*/
    uint8 intf_div_b;   /*refer to sys_datapath_clktree_div_t, usefull pllb is used*/
    sys_wb_datapath_serdes_info_t  serdes_info[HSS15G_LANE_NUM];   /*hss28G only 4 serdes info is valid, refer to sys_datapath_serdes_info_t  */
    uint8 plla_ref_cnt;      /*indicate used lane number for the plla, if the num decrease to 0, set plla to disable*/
    uint8 pllb_ref_cnt;      /*indicate used lane number for the pllb, if the num decrease to 0, set pllb to disable*/
    uint8 pllc_ref_cnt;      /*indicate used lane number for the pllc, if the num decrease to 0, set pllc to disable  For TM only*/
    uint16 clktree_bitmap; /*indicate clktree need cfg, refer to  sys_datapath_clktree_op_t */
};
typedef struct sys_wb_datapath_hss_attribute_s sys_wb_datapath_hss_attribute_t;

/****************************************************************
*
* ftm module
*
****************************************************************/
enum sys_wb_appid_ftm_subid_e
{
    SYS_WB_APPID_FTM_SUBID_L2MC,
    SYS_WB_APPID_FTM_SUBID_FCOE_TRILL,
    SYS_WB_APPID_FTM_SUBID_MAX
};
struct sys_wb_ftm_ad_s
{
    uint32 ad_index;
    uint32 calc_key_len[0];
};
typedef struct sys_wb_ftm_ad_s sys_wb_ftm_ad_t;

/****************************************************************
*
* register module
*
****************************************************************/
enum sys_wb_appid_register_subid_e
{
    SYS_WB_APPID_REGISTER_SUBID_MASTER,
    SYS_WB_APPID_REGISTER_SUBID_TRUNC_POOL,
    SYS_WB_APPID_REGISTER_SUBID_MAX
};
typedef enum sys_wb_appid_register_subid_e sys_wb_appid_register_subid_t;

struct sys_wb_register_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];
    /*data*/
    uint32 version;
    uint32 oam_coexist_mode :8;
    uint32 derive_mode      :3;
    uint32 flow_record_en   :1;
    uint32 logic_threshold:8;
    uint32 wb_keep_knet     :8;
    uint32 station_move_mode:1;
    uint32 rsv              :3;

    uint32 nsh_edit_max_num;
};
typedef struct sys_wb_register_master_s sys_wb_register_master_t;

struct sys_wb_register_trunc_pool_s
{
    /*key*/
    uint8 profile_id;
    uint8 rsv[3];
    uint32 calc_key_len[0];
    /*data*/
    uint32 ref_cnt;
};
typedef struct sys_wb_register_trunc_pool_s sys_wb_register_trunc_pool_t;

/****************************************************************
*
* packet module
*
****************************************************************/
#define WB_PKT_MAX_NETIF_NAME_LEN        16
enum sys_wb_appid_packet_subid_e
{
    SYS_WB_APPID_PACKET_SUBID_MASTER,
    SYS_WB_APPID_PACKET_SUBID_NETIF,
    SYS_WB_APPID_PACKET_SUBID_MAX
};
typedef enum sys_wb_appid_packet_subid_e sys_wb_appid_packet_subid_t;

struct sys_wb_pkt_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];
    /*data*/
    uint32 version;
};
typedef struct sys_wb_pkt_master_s sys_wb_pkt_master_t;

struct sys_wb_pkt_netif_s
{
    /*key*/
    uint8 type;     /**<[TM] Network interface type, 0: associated with physical switch port, 1: associated with specified vlan id */
    uint8 rsv;
    uint16 vlan;    /**<[TM] Vlan id associated with this interface */
    uint32 gport;  /**<[TM] Local port associated with this interface */
    uint16 if_id;
    uint32 flag;
    uint32 calc_key_len[0];
    /*data*/
    mac_addr_t mac; /**<[TM] MAC address associated with this interface */
    char name[WB_PKT_MAX_NETIF_NAME_LEN]; /**<[TM] Network interface name */
};
typedef struct sys_wb_pkt_netif_s sys_wb_pkt_netif_t;

struct sys_wb_app_id_s
{
   uint32    app_id;
   uint32    entry_size;
   //uint16    rsv;

   uint32    entry_num;
   uint8 real_time_en;
};
typedef struct sys_wb_app_id_s sys_wb_app_id_t;

/****************************************************************
*
* srv6 module
*
****************************************************************/
enum sys_wb_appid_srv6_subid_e
{
    SYS_WB_APPID_SRV6_SUBID_MASTER,
    SYS_WB_APPID_SRV6_SUBID_MAX
};
typedef enum sys_wb_appid_srv6_subid_e sys_wb_appid_srv6_subid_t;

struct sys_wb_srv6_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    uint32 fp_id_swap;
    uint32 fp_id_psp;
    uint32 fp_id_shift;
    uint32 fp_id_gsid_swap;
    uint32 fp_id_gsid_pop;
    uint32 fp_id_gsid_psp;
    uint32 udf_idx_base:16;
    uint32 sid_format:8;
    uint32 masklen_scl0:8;
    uint32 masklen_scl1:8;
    uint32 ldp_base:16;
    uint32 rsv:8;
    uint32 fp_id_usp;
	uint32 fp_id_am_de_masq;
};
typedef struct sys_wb_srv6_master_s sys_wb_srv6_master_t;



/****************************************************************
*
* monitor module
*
****************************************************************/
enum sys_wb_appid_monitor_subid_e
{
    SYS_WB_APPID_MONITOR_SUBID_MASTER,
    SYS_WB_APPID_MONITOR_SUBID_PATH_LATENCY,
    SYS_WB_APPID_MONITOR_SUBID_BUFF_SCAN_CTL,
    SYS_WB_APPID_MONITOR_SUBID_MAX
};
#define SYS_WB_MONITOR_MAX_VIEWID 64
struct sys_wb_monitor_port_s
{
    uint8  valid;
    uint16 lport;
    uint16 ref_cnt;
};
typedef struct sys_wb_monitor_port_s sys_wb_monitor_port_t;

struct sys_wb_monitor_master_s
{
    /*key*/
    uint8 lchip;
    uint8 rsv[3];
    uint32 calc_key_len[0];
    /*data*/
    uint32 version;
    sys_wb_monitor_port_t port_array[2][SYS_WB_MONITOR_MAX_VIEWID];

    uint32 total_en_igs     : 1,
           total_en_egs     : 1,
           sc_en_igs        : 1,
           sc_en_egs        : 1,
           c2c_en_igs       : 1,
           c2c_en_egs       : 1,
           critical_en_igs  : 1,
           critical_en_egs  : 1,
           round_trip_en    : 1, /*Ingress uc*/
           span_en          : 1, /*Egress mc*/
           rsv1             : 22;
 };
typedef struct sys_wb_monitor_master_s sys_wb_monitor_master_t;
struct sys_wb_monitor_path_latency_s
{
    /*key*/
    uint16 src_lport;
    uint16 dst_lport;
    uint32 calc_key_len[0];
    /*data*/
};
typedef struct sys_wb_monitor_path_latency_s sys_wb_monitor_path_latency_t;

struct sys_wb_monitor_buf_scan_ctl_s
{
    /*key*/
    uint16 lport;
    uint16 rsv;
    uint32 calc_key_len[0];

    /*data*/
    uint32 port_sc_en_igs : 1;
    uint32 port_sc_en_egs : 1;
    uint32 port_tc_en_igs : 1;
    uint32 port_tc_en_egs : 1;
    uint32 queue_en       : 1;
    uint32 port_en_igs    : 1;
    uint32 port_en_egs    : 1;
    uint32 rsv1           : 25;
};
typedef struct sys_wb_monitor_buf_scan_ctl_s sys_wb_monitor_buf_scan_ctl_t;


/****************************************************************
*
* sc oam module
*
****************************************************************/
enum sys_wb_appid_sc_oam_subid_e
{
    SYS_WB_APPID_SC_OAM_SUBID_MASTER,
    SYS_WB_APPID_SC_OAM_SUBID_MEP,
    SYS_WB_APPID_SC_OAM_SUBID_MAX
};
typedef enum sys_wb_appid_sc_oam_subid_e sys_wb_appid_sc_oam_subid_t;

struct sys_wb_sc_oam_mep_s
{
    /*key*/
    uint32 client_id;   /* clientId */
    uint32 calc_key_len[0];

    /*data*/
    uint16 client_speed;
    uint8 bas_tx_period;
    uint16 aps_grp_id;/* aps group for state machine, alloc by opf*/
    uint32 rei_index;
    uint32 ber_index;
    uint16 hw_client_id;

};
typedef struct sys_wb_sc_oam_mep_s sys_wb_sc_oam_mep_t;

struct sys_wb_sc_oam_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    uint32 rx_defect_vector[2];
    uint32 update_defect_vector[2];
    uint8 hw_aps;/*run APS state machine and do APS switch automatically*/
};
typedef struct sys_wb_sc_oam_master_s sys_wb_sc_oam_master_t;

/****************************************************************
*
* npm module
*
****************************************************************/
enum sys_wb_appid_npm_subid_e
{
    SYS_WB_APPID_NPM_SUBID_MASTER,
    SYS_WB_APPID_NPM_SUBID_SESSION,
    SYS_WB_APPID_NPM_SUBID_SESSION_LITE,
    SYS_WB_APPID_NPM_SUBID_IM_FLOW_HASH,
    SYS_WB_APPID_NPM_SUBID_MAX
};
typedef enum sys_wb_appid_npm_subid_e sys_wb_appid_npm_subid_t;

struct sys_wb_npm_master_s
{
    /*key*/
    uint8 lchip;
    uint8 rsv[3];
    uint32 calc_key_len[0];

    /*data*/
    uint32 version;
    uint16 config_dmm_bitmap;
    uint16 tx_dmm_en_bitmap;
    uint8  ecpu_npm_im_en;
    uint8  rsv0[3];
    uint32 src_node_fp_id[SYS_IM_MAX_TYPE];
    uint32 src_node_delay_fp_id[SYS_IM_MAX_TYPE];
    uint32 sink_node_fp_id[SYS_IM_MAX_TYPE];
};
typedef struct sys_wb_npm_master_s sys_wb_npm_master_t;

struct sys_wb_npm_session_s
{
    /*key*/
    uint32 session_id;
    uint32 calc_key_len[0];

    /*data*/
    uint32 mep_idx;
    uint32 is_ntp_ts :1;
    uint32 flr_for_ses :8;
    uint32 rsv :23;
    uint32 avl_period_thrd;
};
typedef struct sys_wb_npm_session_s sys_wb_npm_session_t;

struct sys_wb_npm_session_lite_s
{
    /*key*/
    uint32 session_id;
    uint32 calc_key_len[0];

    /*data*/
    uint32 ts_format : 8;
    uint32 mode :8;
    uint32 is_twamp : 1;
    uint32 is_ipv6 : 1;
    uint32 rsv : 14;
    uint32 mep_idx;
    uint32 twamp_idx;
    uint32 ma_idx;
};
typedef struct sys_wb_npm_session_lite_s sys_wb_npm_session_lite_t;

struct sys_wb_npm_im_flow_hash_s
{
    /*key*/
    uint32 flow_id;
    uint32 calc_key_len[0];

    /*action*/
    uint32 flow_type :2;
    uint32 loss_prof_id:3;
    uint32 fih_type:2;
    uint32 delay_prof_id:12;
    uint32 delay_prof_id_valid:1;
    uint32 type:2;
    uint32 l_valid:1;
    uint32 l_flag:1;
    uint32 d_flag:1;
    uint32 ip_im_type:2;
    uint32 acl_bind_en:1;
    uint32 rsv:4;

    uint32 stats_id;
    uint32 metadata:15;
    uint32 rsv1:17;
    uint32 igs_stats_ptr;
    uint32 egs_stats_ptr;

    uint32 acl_entry_id;
};
typedef struct sys_wb_npm_im_flow_hash_s sys_wb_npm_im_flow_hash_t;

struct sys_wb_com_pp_bmp_s
{
    uint32 id;
    uint8  type;
    uint32 calc_key_len[0];

    uint16 pp_bmp;
};
typedef struct sys_wb_com_pp_bmp_s sys_wb_com_pp_bmp_t;


/****************************************************************
*
* pon module
*
****************************************************************/

enum sys_wb_appid_pon_subid_e
{
    SYS_WB_APPID_PON_SUBID_PORT,
    SYS_WB_APPID_PON_SUBID_GEM_PORT,
    SYS_WB_APPID_PON_SUBID_VLAN_PORT,
    SYS_WB_APPID_PON_SUBID_MAX
};
typedef enum sys_wb_appid_pon_subid_e sys_wb_appid_pon_subid_t;

struct sys_wb_pon_port_db_s
{
    /*key*/
    uint16 lport;
    uint32 calc_key_len[0];
    /*data*/
    uint8 vlan_range_grp;
    uint16 vlan_range_grp_cnt;
    uint8 rsv;
};
typedef struct sys_wb_pon_port_db_s sys_wb_pon_port_db_t;

struct sys_wb_pon_gem_port_db_s
{
    /*key*/
    uint16 lport;           /*bit16 indicates the flooding gemport*/
    uint16 tunnel_value;
    uint32 calc_key_len[0];

    /*data*/
    uint16 egs_service_id;
    uint16 igs_policer_id;
    uint32 hw_tbl_index;
};
typedef struct sys_wb_pon_gem_port_db_s sys_wb_pon_gem_port_db_t;

struct ctc_wb_scl_vlan_edit_s
{
    uint8  stag_op;         /**< [GB.GG.D2.TM.TMM.AT] operation type of stag, see CTC_VLAN_TAG_OP_XXX  */
    uint8  svid_sl;         /**< [GB.GG.D2.TM.TMM.AT] select type of svid, see CTC_VLAN_TAG_SL_XXX  */
    uint8  scos_sl;         /**< [GB.GG.D2.TM.TMM.AT] select type of scos, see CTC_VLAN_TAG_SL_XXX  */
    uint8  scfi_sl;         /**< [GB.GG.D2.TM.TMM.AT] select type of scfi, see CTC_VLAN_TAG_SL_XXX  */
    uint16 svid_new;        /**< [GB.GG.D2.TM.TMM.AT] new svid, valid only if svid_sl is CTC_VLAN_TAG_OP_REP|CTC_VLAN_TAG_OP_REP_OR_ADD|CTC_VLAN_TAG_OP_ADD*/
    uint8  scos_new;        /**< [GB.GG.D2.TM.TMM.AT] new scos, valid only if scos_sl is CTC_VLAN_TAG_OP_REP|CTC_VLAN_TAG_OP_REP_OR_ADD|CTC_VLAN_TAG_OP_ADD*/
    uint8  scfi_new;        /**< [GB.GG.D2.TM.TMM.AT] new scfi, valid only if scfi_sl is CTC_VLAN_TAG_OP_REP|CTC_VLAN_TAG_OP_REP_OR_ADD|CTC_VLAN_TAG_OP_ADD*/

    uint8  ctag_op;         /**< [GB.GG.D2.TM.TMM.AT] operation type of ctag, see CTC_VLAN_TAG_OP_XXX */
    uint8  cvid_sl;         /**< [GB.GG.D2.TM.TMM.AT] select type of cvid, see CTC_VLAN_TAG_SL_XXX */
    uint8  ccos_sl;         /**< [GB.GG.D2.TM.TMM.AT] select type of ccos, see CTC_VLAN_TAG_SL_XXX */
    uint8  ccfi_sl;         /**< [GB.GG.D2.TM.TMM.AT] select type of ccfi, see CTC_VLAN_TAG_SL_XXX */
    uint16 cvid_new;        /**< [GB.GG.D2.TM.TMM.AT] new cvid, valid only if cvid_sl is CTC_VLAN_TAG_OP_REP|CTC_VLAN_TAG_OP_REP_OR_ADD|CTC_VLAN_TAG_OP_ADD*/
    uint8  ccos_new;        /**< [GB.GG.D2.TM.TMM.AT] new ccos, valid only if ccos_sl is CTC_VLAN_TAG_OP_REP|CTC_VLAN_TAG_OP_REP_OR_ADD|CTC_VLAN_TAG_OP_ADD*/
    uint8  ccfi_new;        /**< [GB.GG.D2.TM.TMM.AT] new ccfi, valid only if ccfi_sl is CTC_VLAN_TAG_OP_REP|CTC_VLAN_TAG_OP_REP_OR_ADD|CTC_VLAN_TAG_OP_ADD*/

    uint8  vlan_domain;     /**< [GB.GG.D2.TM.TMM.AT] refer ctc_scl_vlan_domain_t. [ingress] */
    uint8  tpid_index;      /**< [GB.GG.D2.TM.TMM.AT] svlan tpid index, if set 0xff, tpid disable*/

};
typedef struct ctc_wb_scl_vlan_edit_s ctc_wb_scl_vlan_edit_t;

struct sys_wb_pon_vlan_port_s
{
    /*key*/
    uint32 vlan_port_id;
    uint32 calc_key_len[0];

    /*data*/
    uint8 criteria;
	uint8 rsv[3];
    uint32 flag;
    uint16 lport;
    uint16 tunnel_value;
    uint16 match_svlan_end;
    uint16 match_cvlan_end;

    uint16 vn_tag;
    uint32 logic_port;
    uint32 logic_dest_port;
    uint32 acl_logic_port;
    uint32 xlate_nhid;
    uint8 scl_id;

    ctc_wb_scl_vlan_edit_t egs_vlan_action;

    uint32 scl_eid;
};
typedef struct sys_wb_pon_vlan_port_s sys_wb_pon_vlan_port_t;
/****************************************************************
*
* flexe module
*
****************************************************************/
struct sys_wb_flexe_inst_state_s
{
    uint32 inst_offset; /* key */
    uint32 event_bmp; /* ctc_flexe_event_type_t */
    uint32 group_num;
    uint32 instance_num;
    
    uint8  flexe_map[SYS_FLEXE_OH_FRAME_NUM];
    uint8  rsv0[3];

    uint32 client_map[SYS_FLEXE_OH_MAX_SLOT_PER_INST];
    uint32 client_map_b[SYS_FLEXE_OH_MAX_SLOT_PER_INST];
};
typedef struct sys_wb_flexe_inst_state_s sys_wb_flexe_inst_state_t;

struct sys_wb_flexe_phy_s
{
    uint32                       phy_number;

    uint8                        logical_serdes_base;
    uint8                        inst_base;
    uint8                        pcs_mode;
    uint8                        fec_type;
    uint8                        rsv;

    uint32                       crc_cnt;
    uint32                       event_bmp;
    sys_wb_flexe_inst_state_t    remote_state[SYS_FLEXE_MAX_OH_PHY_INST_CNT];
};
typedef struct sys_wb_flexe_phy_s sys_wb_flexe_phy_t;

struct sys_wb_flexe_inst_s
{
    uint8   slot_cfg_shim_chid[SYS_FLEXE_MAX_SLOT_PER_INST];
    uint8   rsv0[2];
    uint8   switch_shim_chid_a[SYS_FLEXE_MAX_SLOT_PER_INST];
    uint8   rsv1[2];
    uint8   switch_shim_chid_b[SYS_FLEXE_MAX_SLOT_PER_INST];
    uint8   rsv2[2];

    uint16  flush_bmp;        /* carry SYS_FLEXE_MAX_SLOT_PER_INST slots */
    
    uint8   crcac_intr_bmp;   /* bit[1:0] - cr
                                 bit[3:2] - ca
                                 bit[5:4] - c
                                 value 0: no intr; 1 - falling; 2 - rising
                                 only used for RX
                               */
    uint8   cr_flip       :2;  /* refer to sys_flexe_oh_flip_type_t; only used for RX */
    uint8   ca_flip       :2;  /* refer to sys_flexe_oh_flip_type_t; only used for RX */
    uint8   c_flip        :2;  /* refer to sys_flexe_oh_flip_type_t; only used for RX */
    uint8   rsv_bit       :2;  /* refer to sys_flexe_oh_flip_type_t; only used for RX */
    
    uint8   rsv3;
};
typedef struct sys_wb_flexe_inst_s sys_wb_flexe_dir_inst_t;

struct sys_wb_flexe_cc_inst_s
{
    uint8 slot_cnt;
    uint8 slot_list[SYS_FLEXE_MAX_SLOT_PER_INST];
    uint8 cc_subcalmask;   /* carry 8*66bit block */
};
typedef struct sys_wb_flexe_cc_inst_s sys_wb_flexe_cc_inst_t;

struct sys_wb_flexe_group_cc_s
{
    uint8                   cycle_value;
    uint8                   shim_chid;
    sys_wb_flexe_cc_inst_t* inst;
};
typedef struct sys_wb_flexe_group_cc_s sys_wb_flexe_group_cc_t;

struct sys_wb_flexe_group_ic_s
{
    uint8  shim_chid;
    uint16 ic_subcalmask;   /* carry SYS_FLEXE_MAX_SLOT_PER_INST slots */
};
typedef struct sys_wb_flexe_group_ic_s sys_wb_flexe_group_ic_t;

struct sys_wb_flexe_group_dir_s
{
    uint8                            active;      /* SYS_FLEXE_ACTIVE_A / SYS_FLEXE_ACTIVE_B */
    uint8                            crac_state;  /* sys_flexe_group_crac_state_t */
    sys_wb_flexe_dir_inst_t*         dir_inst;
};
typedef struct sys_wb_flexe_group_dir_s sys_wb_flexe_group_dir_t;

struct sys_wb_flexe_client_dir_s
{
    uint8 op;   /* sys_flexe_client_state_t */
    uint8 read_ptr;
    uint8 rsv[2];
};
typedef struct sys_wb_flexe_client_dir_s sys_wb_flexe_client_dir_t;

struct sys_wb_flexe_master_s
{
    /*key*/
    uint32 lchip;
    uint32 calc_key_len[0];
    
    /*data*/
    uint32 version;
    uint8  polling_status;
    uint8  rsv[3];
};
typedef struct sys_wb_flexe_master_s sys_wb_flexe_master_t;

struct sys_wb_flexe_group_s
{
    /*key*/
    uint32 group_id;
    uint32 calc_key_len[0];

    /*data*/
    uint32                    group_number;
    uint8                     switch_mode;     /* sys_flexe_switch_mode_t */
    uint8                     rx_cfg_mode;     /* ctc_flexe_group_rx_mode_t */
    uint8                     flexe_shim_id;
    uint8                     inst_cnt;
    uint8                     phy_cnt;
    uint8                     pad_en;    
    uint8                     rsv[2];
    uint32                    event_bmp;
    sys_wb_flexe_phy_t*       phy_list;
    uint8*                    inst_list;

    sys_wb_flexe_group_dir_t  tx;
    sys_wb_flexe_group_dir_t  rx;
    uint32                    cr_timer;  
};
typedef struct sys_wb_flexe_group_s sys_wb_flexe_group_t;

struct sys_wb_flexe_client_s
{
    /*key*/
    uint32 client_id;
    uint32 calc_key_len[0];

    /*data*/
    uint32                      client_number;
    uint32                      group_id;

    uint8                       flexe_shim_id;
    uint8                       shim_chid;
    uint8                       tx_xc_chid;
    uint8                       rx_xc_chid;

    uint32                      cross_client_id;
    uint32                      gport;

    uint16                      mac_id;
    uint8                       chan_id;
    uint8                       cross_enable    :1;
    uint8                       aps_role        :2;  /*0:no aps, 1:aps working path, 2:aps protect path*/
    uint8                       bind_oam        :1;  /*0:no bind oam, 1:bind oam*/
    uint8                       rsv             :4;

    uint8                       flow_type;
    uint8                       rsv1[3];

    sys_wb_flexe_client_dir_t   tx;
    sys_wb_flexe_client_dir_t   rx;
};
typedef struct sys_wb_flexe_client_s sys_wb_flexe_client_t;

struct sys_wb_flexe_group_mem_s
{
    /*key*/
    uint32 group_id;
    uint32 calc_key_len[0];

    /*data*/
    sys_flexe_phy_t        phy_list[SYS_FLEXE_GROUP_MAX_PHY_CNT];
    uint8                  inst_list[SYS_FLEXE_MAX_INST_CNT];
    sys_flexe_dir_inst_t   tx_dir_inst[SYS_FLEXE_MAX_INST_CNT];
    sys_flexe_dir_inst_t   rx_dir_inst[SYS_FLEXE_MAX_INST_CNT];
};
typedef struct sys_wb_flexe_group_mem_s sys_wb_flexe_group_mem_t;


#ifdef __cplusplus
}
#endif

#endif
